Having a Pandas DataFrame with a column of TimeStamp yyyy-mm-dd HH:MM:SS timezone (e.g. 2020-06-01 04:26:00-05:00), how to extract new column with only yyyy-mm-dd HH
Tried:
df.index = df.Time.to_period(freq='T').index
Result in: yyyy-mm-dd HH:MM
CodePudding user response:
you can use:
df['new_date']=df['your_date_columns'].dt.strftime('%Y-%m-%d %H')