2024-09-29 02:22:36 发布
网友
我有以下熊猫支点
Apple Green 5 Red 3 Yellow 4 Grapes Red 1 Green 3
并希望将此数据转换为JSON,如下所示:
我该怎么做?我尝试过使用json(),它返回不同的格式。在
在DataFrame.to_json有几个用于JSON方向的参数。在
尝试类似pd.to_json(orient='records')的方法,如果不起作用,请检查http://pandas.pydata.org/pandas-docs/version/0.17.1/generated/pandas.DataFrame.to_json.html中orient变量的其他值
pd.to_json(orient='records')
在DataFrame.to_json有几个用于JSON方向的参数。在
尝试类似
pd.to_json(orient='records')
的方法,如果不起作用,请检查http://pandas.pydata.org/pandas-docs/version/0.17.1/generated/pandas.DataFrame.to_json.html中orient变量的其他值相关问题 更多 >
编程相关推荐