Created
February 23, 2018 11:52
-
-
Save StevenReitsma/2d5650eadc2e5a59fa4f749f19c9c7eb to your computer and use it in GitHub Desktop.
Blogpost-Heineken8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def force_float_df(df): | |
def force_float_col(x): | |
try: | |
return x.astype(float) | |
except: | |
return pd.factorize(x)[0] | |
return df.apply(force_float_col) | |
forward_sale_cols = ['weekly_sales1', 'weekly_sales2'] | |
drop_cols = ['date'] | |
all_drop_cols = forward_sale_cols + drop_cols | |
X_pd = df_features.drop(all_drop_cols, axis=1) | |
X_pd_num = force_float_df(X_pd).values | |
y = df_features[forward_sale_cols].values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment