Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 熊猫到JSON:更改列的名称_Python_Json_Pandas - Fatal编程技术网

Python 熊猫到JSON:更改列的名称

Python 熊猫到JSON:更改列的名称,python,json,pandas,Python,Json,Pandas,我想给出列名,我通常这样做是为了输出到Excel df = pd.concat([a,b,c,d,e], axis=1, sort=False) 但是当我输出到JSON时,我应该在哪里提供头输入呢 df.to_excel ("ids.xlsx", index = None, header=['IDs', 'Phases','Versions','Internal Version List','Tests']) 可以使用以下方法预先设置列名: df.to_json ('Export_DataF

我想给出列名,我通常这样做是为了输出到Excel

df = pd.concat([a,b,c,d,e], axis=1, sort=False)
但是当我输出到JSON时,我应该在哪里提供头输入呢

df.to_excel ("ids.xlsx", index = None, header=['IDs', 'Phases','Versions','Internal Version List','Tests'])

可以使用以下方法预先设置列名:

df.to_json ('Export_DataFrame.json', orient='table')
在您可以使用以下命令将数据帧写入json之后:

df.columns = ['IDs', 'Phases','Versions','Internal Version List','Tests']

预先设置名称
df.columns=['IDs','Phases','Versions','Internal Version List','Tests']
,然后
df.to_json(…)
你能把这个写成答案吗,这样我就把它标记为完成了,然后它也会对其他人有帮助。谢谢
df.to_json ('Export_DataFrame.json', orient='table')