在使用熊猫的 to_json 函数从 CSV 接收正确的日期格式数据时,我仍然面临问题。
import pandas as pd
import json
df = pd.read_csv("C:\\Users\\shubham\\Desktop\\Output\\MasterData.csv")
df1 = df.to_json(orient='records')
print(df1)
[{"invoiceDate":"18\/08\/2019","amount":1140.87}]
我期待输出:-“invoiceDate”:“18/08/2019”
我已经尝试过 to_json 参数:- date_format = "iso" double_precision = 10, force_ascii = True, date_unit = "ms", default_handler = None),并且替换也不起作用(df.replace("/","")) .