Kaggle competition: Riiid Answer Correctness Prediction
sex_survival = train.groupby('Sex' ).Survived.value_counts()
sex_survival<groupby>
import numpy as np
import pandas as pd
import bisect
import math
import numbers
import decimal
import riiideducation
sex_survived_average = train[['Sex', 'Survived']].groupby(['Sex'], as_index=False ).mean()
sex_survived_average<count_values>
persons = pd.read_csv(".. /input/persons/persons.txt",sep="\t")
 pafile = pd.read_csv(".. /input/pafile40x135/pafile40x135.txt",sep="\t")
 iafile = pd.read_csv(".. /input/iafileall40/iafileall40.txt",sep="\t")
 if pafile.iat[393656,0]!=393656:
print("bad pafile")
 exit
if iafile.iat[13523,0]!=13523:
print("bad iafile")
 exit
print("loaded")
train.Embarked.value_counts()<count_values>
env = riiideducation.make_env()
train.groupby('Embarked' ).Survived.value_counts()<groupby>
def mikes(df):
user = df['user_id']
content=df['content_id']
if df['content_type_id'] != 0: content = 0
p = prob(user, content)
 df['timestamp']=p
return df['timestamp']
train[['Embarked', 'Survived']].groupby(['Embarked'], as_index=False ).mean()<count_values>
iter_test = env.iter_test()
for(test_df, sample_prediction_df)in iter_test:
test_df['timestamp'] = test_df.apply(mikes,axis=1)
 test_df=test_df.rename(columns = {'timestamp':'answered_correctly'})
 env.predict(test_df.loc[test_df['content_type_id'] == 0, ['row_id', 'answered_correctly']])
 print("done - yeah!")