Answers for "pandas csv save index as datetime"

1

time date in pandas to csv file

try:
    df.to_csv(
             path_to_csv + f'\{file_name}_{now.strftime("%Y-%m-%d")}_to_{now.strftime("%H.%M")}.csv',
             date_format='%Y-%m-%d %H:%M:%S', encoding='utf-8', index=False)
except OSError as e:
             print("Failed to create the file.......")
             raise SystemExit(e)
Posted by: Guest on May-13-2021
4

save dataframe to csv without index

df.to_csv(f"{filename}", index=False)
Posted by: Guest on March-07-2021

Code answers related to "pandas csv save index as datetime"

Python Answers by Framework

Browse Popular Code Answers by Language