I have the following nested dictionary dict
:
{
'x1':
{
'k1':
{
'first_col': 'Date',
'col_type': pandas._libs.tslibs.timestamps.Timestamp,
'col_min_val': Timestamp('2017-12-04 00:00:00')
},
'k2':
{
'first_col': 'Date',
'col_type': pandas._libs.tslibs.timestamps.Timestamp,
'col_min_val': Timestamp('2018-02-02 00:00:00')
}
}
'x2':
{
'k1':
{
'first_col': 'Date',
'col_type': pandas._libs.tslibs.timestamps.Timestamp,
'col_min_val': Timestamp('2017-12-04 05:00:00')
}
}
}
I need to get this pandas DataFrame:
col1 col2 first_col col_type col_min_val
x1 k1 Date pandas._libs.tslibs.timestamps.Timestamp Timestamp('2017-12-04 00:00:00')
x1 k2 Date pandas._libs.tslibs.timestamps.Timestamp Timestamp('2018-02-02 00:00:00')
x2 k1 Date pandas._libs.tslibs.timestamps.Timestamp Timestamp('2017-12-04 05:00:00')
This is what I tried, but the result does not coincide with the expected one:
pd.DataFrame(dict).stack().reset_index()