0

I am copying data from one dataframe to the other frame. In the new dataframe I want to set the TimeStamp column to use the dateformat 2020-05-29 But I am getting an error.

ls2_df= ls_df[(ls_df.Manager == "David H") & (ls_df.Store == 4007)]
ls2_df['TimeStamp'] = pd.to_datetime(ls2_df.TimeStamp)

Gives the following error.

A value is trying to be set on a copy of a slice from a DataFrame. Try using .loc[row_indexer,col_indexer] = value instead

Emma
  • 27,428
  • 11
  • 44
  • 69
newdeveloper
  • 534
  • 3
  • 17
  • ls2_df= ls_df[(ls_df.Manager == "David H") & (ls_df.Store == 4007)].copy(), add copy at the end – BENY Jul 06 '20 at 00:26
  • I added the `.copy()` however the timestamp is still not formatting to `2020-05-29` like the `parse_dates` – newdeveloper Jul 06 '20 at 00:29

0 Answers0