application_vnd.jupyter.stderr_output_1.png
import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

dfs = {}
for name in ['train', 'test']:
    df = pd.read_csv('/kaggle/input/bike-sharing-demand/%s.csv' % name)
    df['_data'] = name
    dfs[name] = df

df = dfs['train'].append(dfs['test'])
df.columns = map(str.lower, df.columns)

dt = pd.DatetimeIndex(df['datetime'])
df.set_index(dt, inplace=True)
df['date'] = dt.date
df['day'] = dt.day
df['month'] = dt.month
df['year'] = dt.year
df['hour'] = dt.hour
df['dow'] = dt.dayofweek
df['woy'] = dt.weekofyear

df['holiday'] = df[['month', 'day', 'holiday', 'year']].apply(lambda x: (x['holiday'], 1)[x['year'] == 2012 and x['month'] == 10 and (x['day'] in [30])], axis=1)
df['holiday'] = df[['month', 'day', 'holiday']].apply(lambda x: (x['holiday'], 1)[x['month'] == 12 and x['day'] in [24, 26, 31]], axis=1)
df['workingday'] = df[['month', 'day', 'workingday']].apply(lambda x: (x['workingday'], 0)[x['month'] == 12 and x['day'] in [24, 31]], axis=1)