jsonファイルの加工手順についてアドバイスを頂きたいです。
背景:salesforceに登録されたレポート結果を取得し、
最終的にdataframeとして整形し分析できるがが目的です。
APIにて取得したjsonファイルはOrderedDict形式であることは分かりましたが、
pandas DataFrameへの整形方法を知りたいです。
salesforceAPIからレポート結果を取得できれば、
このやり方に拘っているわけでありません。
python 3.5.3
pandas 0.23.4
simple=salesforce 0.74.2
取得した結果 reportJSON
OrderedDict([('attributes', OrderedDict([('describeUrl',
これをpandas.dataframeに変換する際に試したコード
1、pd.Dataframe(reportJSON)
2、pd.read_json(reportJSON)
参考コード
python
1from simple_salesforce import Salesforce 2import requests 3import base64 4import json 5 6sf = Salesforce(username=[username],password=[password],security_token=[token]) 7reportId = '00OR0000000K2UeMAK' 8reportRESTPath = ('analytics/reports/{id}'.format(id='00OR0000000K2UeMAK') 9 10# Synchronous report get 11 12reportJSON = sf.restful(reportRESTPath, {'includeDetails': 'true'})
あなたの回答
tips
プレビュー