for event in events:
    featureX = request.get(API_URL + event)
tmp = pd.DataFrame(featureX.json()['users'])
df.loc[df.event_id == event, 'featureX'] = df.loc[df.event_id == event,
    'user_id'].map(tmp.set_index('user_id').featureX)
df_X = df.drop(['date', 'event_id', 'user_id'], axis=1)
df['prediction'] = loaded_model.predict_proba(df_X)
end = time.time()
Python: How to make machine learning predictions run faster in production?