Aug-06-2020, 01:50 PM
Hi,
I have below data in csv file, and I read the file and rewrite. When write to csv using df.to_csv, it lossing time format, I want to show full time format (yyyy/mm/dd hh:mm:ss). How to define the time formart.
The time in csv file showing (when open) in the form: mm:ss.0, but when I click on particular cell the time format is
mm:ss.o
I have below data in csv file, and I read the file and rewrite. When write to csv using df.to_csv, it lossing time format, I want to show full time format (yyyy/mm/dd hh:mm:ss). How to define the time formart.
The time in csv file showing (when open) in the form: mm:ss.0, but when I click on particular cell the time format is
mm:ss.o
Name Age date_in date_out A 23 2020/08/07 20:12 2020/08/07 20:45 B 28 2020/08/11 20:12 2020/08/11 20:42but it showing (unless I click on cell to see full time format)
Name Age date_in date_out A 23 20:12 20:45 B 28 20:12 20:42But I want to write in to file an dshow it in fie whne open:
Name Age date_in date_out A 23 2020/08/07 20:12 2020/08/07 20:45 B 28 2020/08/11 20:12 2020/08/11 20:42I use below code:
import pandas as pd df = pd.read_csv(r'PythonCodes\timeForm2.csv') df.dropna(how='any',inplace=True) df.to_csv('timeFormOut2.csv',index=False)