Reputation: 119
I have the following output:
output = [{'test1': [('No Data', '[Auto] Clock in sync with NTP')]},
{'test2': [('No Data', '[Auto] Clock in sync with NTP'),
('No Data','Lambda - Concurrent Execution Limit')
}]
Needed Dataframe:
test1 test2
0 'No Data', '[Auto] Clock in sync with NTP') 'No Data', '[Auto] Clock in sync with NTP'
1 'No Data','Lambda - Concurrent Execution Limit'
from pprint import pprint
import pandas as pd
df = pd.json_normalize(output)
pprint(df)
Not working as I need. Could you help me?
Upvotes: 0
Views: 51
Reputation: 9481
output = [{'test1': [('No Data', '[Auto] Clock in sync with NTP')]},
{'test2': [('No Data', '[Auto] Clock in sync with NTP'),
('No Data','Lambda - Concurrent Execution Limit')]
}]
You can do this, but it is not a great idea to have lists be cells in a pandas dataframe.
pd.concat([pd.DataFrame(o) for o in output], axis=1)
Upvotes: 2