Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime
- def process_time(data, time_columns, format='%Y-%m-%d %H:%M:%S'):
- # format for uber: '%m/%d/%y %H:%M'
- # format for cabs: '%Y-%m-%d %H:%M:%S'
- # IT PROCESSES IT IN PLACE!
- # if data_name is None ignore format
- if data_name is None:
- for time_col in time_columns:
- data[time_col] = pd.to_datetime(data[time_col], format=format)
- data[time_col] = data[time_col].apply(lambda x: datetime(month=x.month, year=x.year, day=1))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement