1try:
2 df.to_csv(
3 path_to_csv + f'\{file_name}_{now.strftime("%Y-%m-%d")}_to_{now.strftime("%H.%M")}.csv',
4 date_format='%Y-%m-%d %H:%M:%S', encoding='utf-8', index=False)
5except OSError as e:
6 print("Failed to create the file.......")
7 raise SystemExit(e)