Hello, everyone I want to convert from float64 type to datetime, but it doesn't work as I thought. First of all, in float64 format, the value is 44616.107037! If expressed in yyyy/mm/ddhh/mm/mm/ss form in Excel, it is well expressed as 2022/224 2:34:08 I tried to make it look like Python. It's not going as well as I thought.
df1 = df['TIME'].apply(plus)
df2 = df.insert(2, 'RealTIME', df1)
df3 = pd.to_datetime(df['RealTIME'], format='%Y-%m-%d %H:%M:%S')
print(df3)
First of all, it was executed according to the above code, but the conversion to datetime64 works well The display value is 1970-01-0100:00:00.000044616, which is not what I expected Is there any other way to express it?
Thank you.
python datetime
>>> import datetime
>>> d = 44616.107037
>>> s = datetime.date(1900, 1, 1)
>>> s + datetime.timedelta(days=d)
datetime.date(2022, 2, 26)
>>> s = datetime.datetime(1900, 1, 1)
>>> s + datetime.timedelta(days=d)
datetime.datetime(2022, 2, 26, 2, 34, 7, 996800)
df3 = pd.to_datetime(df['RealTIME'], format='%Y/%m/%d %H:%M:%S')
607 Uncaught (inpromise) Error on Electron: An object could not be cloned
886 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
568 Who developed the "avformat-59.dll" that comes with FFmpeg?
599 GDB gets version error when attempting to debug with the Presense SDK (IDE)
© 2024 OneMinuteCode. All rights reserved.