Skip to content

Instantly share code, notes, and snippets.

@Corwinpro
Created March 10, 2019 15:27
Show Gist options
  • Save Corwinpro/d71fd71c58a4bdecad80027359089979 to your computer and use it in GitHub Desktop.
Save Corwinpro/d71fd71c58a4bdecad80027359089979 to your computer and use it in GitHub Desktop.
train_df['year_month'] = train_df['time1'].apply(lambda t: 100 * t.year + t.month).values.reshape(-1, 1)
test_df['year_month'] = test_df['time1'].apply(lambda t: 100 * t.year + t.month).values.reshape(-1, 1)
print(train_df['year_month'].loc[y_train == 1].describe())
train_df = train_df[(train_df['year_month'] >= 201401)]#201309
print(train_df['year_month'].loc[y_train == 1].describe())
### Output
count 1241.000000
mean 201369.155520
std 44.192148
min 201303.000000
25% 201311.000000
50% 201402.000000
75% 201402.000000
max 201402.000000
Name: year_month, dtype: float64
count 1241.000000
mean 201402.705077
std 0.950407
min 201401.000000
25% 201402.000000
50% 201403.000000
75% 201403.000000
max 201404.000000
Name: year_month, dtype: float64
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment