使用 to_datetime pandas 函数。像这样,也许:import pandas as pd#if DATE is the column with datetime values thendf['DATE'] = pd.to_datetime(df['DATE'])这会将列转换为 YYYY-MM-DD 的形式。
可以使用python的datetime模块进行格式化。from datetime import datetime#current date and timenow = datetime.now()#date and time format: dd/mm/YYYY H:M:Sformat = "%d/%m/%Y %H:%M:%S"#format datetime using strftime()time1 = now.strftime(format)print("Formatted DateTime:", time1)