0

I have a column in a dataframe in pandas which contains float numbers and I want to change them into the datetime format. numbers are like:

10    1.647028e+12
11    1.647016e+12
12    1.647016e+12
13    1.647029e+12
14    1.647029e+12
15    1.647029e+12
16    1.646986e+12

And result is:

10   2022-03-11 16:30:00
11   2022-03-11 20:00:01
12   2022-03-11 15:45:01
13   2022-03-11 19:45:01
14   2022-03-11 20:15:00
15   2022-03-11 20:00:02
16   2022-03-11 14:15:00

For doing this I used the code below:

df['dateTime'] = pd.to_datetime(df['dateTime'], unit='ms')

However, it returns this warning:

SettingWithCopyWarning:
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

As I checked there were a related question to this question in Stackoverflow, but it cannot handle my problem. What should I do?

V.Nouri
  • 207
  • 3
  • 15

0 Answers0