Home > front end >  I am trying to merge two dataframes
I am trying to merge two dataframes

Time:05-15

I have this dataframe

firm          formtype  Date_Filed
GameStop Corp.  8-K     2021-04-01

I want to change the Date_Filed to 2021-04-01 00:00:00.

I am using pd.to_datetime(df2['Date_Filed']) but it is not working

CodePudding user response:

Not sure what you meant by merge two dataframes but if all you want is to change the date format of your column, you can do:

df = pd.DataFrame({'firm': {0: 'GameStop Corp.'},'formtype': {0: '8-K'},'Date_Filed': {0: '2021-04-01'}})
df['Date_Filed'] = pd.to_datetime(df['Date_Filed'])
df['Date_Filed1'] = df['Date_Filed'].dt.strftime('%Y/%m/%d %h:%m%s')
  • Related