mysql - How to Python Pandas Dataframe outputs from nested json? -
i'm python beginner. below 'steps_detail' data that;
>>> steps_detail {u'activities-calories': [{u'value': u'1240', u'datetime': u'2015-04-13'}], u'activities-calories-intraday': {u'datasettype': u'minute', u'datasetinterval': 1, u'dataset': [ {u'mets': 10, u'time': u'00:00:00', u'value': 0.8396000266075134, u'level': 0}, {u'mets': 10, u'time': u'00:01:00', u'value': 0.8396000266075134, u'level': 0}, {u'mets': 10, u'time': u'00:02:00', u'value': 0.8396000266075134, u'level': 0}, {u'mets': 10, u'time': u'23:58:00', u'value': 0.8396000266075134, u'level': 0}, {u'mets': 10, u'time': u'23:59:00', u'value': 0.8396000266075134, u'level': 0} ] } }
and want see data using dataframe of pandas that; because using data save mysql.
mets time value level 10 00:00:00 0.8396000266075134 0 10 00:01:00 0.8396000266075134 0 10 00:02:00 0.8396000266075134 0 10 23:58:00 0.8396000266075134 0 10 23:59:00 0.8396000266075134 0
it's not easy me, , has idea? i'm trying, error.
>>>d= dataframe(steps_detail) raise valueerror('mixing dicts non-series may lead 'valueerror: mixing dicts non-series may lead ambiguous ordering.
you can try this
import pandas pd pd.dataframe(steps_detail['activities-calories-intraday']['dataset'])
this return following output
level mets time value 0 0 10 00:00:00 0.8396 1 0 10 00:01:00 0.8396 2 0 10 00:02:00 0.8396 3 0 10 23:58:00 0.8396 4 0 10 23:59:00 0.8396
Comments
Post a Comment