My dictionary is currently setup this way:
{'0001': {'Batting Hours': [79, 154, 50, 172],
'Bowling Hours': [101, 82, 298],
'Date': ['02/02/2019', '02/01/2019', '02/04/2019', '02/03/2019']},
'0002': {'Batting Hours': [7, 23, 40],
'Bowling Hours': [14, 30, 43],
'Date': ['02/04/2019', '02/01/2019', '02/02/2019']}}
How do I unwrap this dictionary so that the dataframe has an output like this:
Code Date Batting Hours Bowling Hours
0001 02/02/2019 79 101
0001 02/01/2019 154 82
I tried looking at documentation on how other similar data structures are unwrapped but I can't seem to get through to mine.
I'm currently appending the values into a list like this
player_agg_hours_dict[Player]['Batting Hours'].append(aggregate_batting_hours)
I'm trying to output to a dataframe like this:
output_df = pd.DataFrame.from_dict(player_agg_hours_dict, orient='index').transpose() # convert dict to dataframe
and I know that the from_dict()
parameters have to be something different.