I have a dataframe which looks like this:
df= pd.DataFrame({'methods': {0: {'get': 12,
'post': 4,
'put': 1,
'delete': 1,
'patch': 0,
'head': 0,
'options': 0,
'trace': 0,
'connect': 0},
1: {'get': 13,
'post': 4,
'put': 1,
'delete': 1,
'patch': 0,
'head': 0,
'options': 0,
'trace': 0,
'connect': 0},
2: {'get': 13,
'post': 4,
'put': 1,
'delete': 1,
'patch': 0,
'head': 0,
'options': 0,
'trace': 0,
'connect': 0},
3: {'get': 3,
'post': 1,
'put': 2,
'delete': 1,
'patch': 1,
'head': 0,
'options': 0,
'trace': 0,
'connect': 0,
'parameters': {'$numberDouble': 'NaN'}},
4: {'get': 3,
'post': 1,
'put': 2,
'delete': 1,
'patch': 1,
'head': 0,
'options': 0,
'trace': 0,
'connect': 0,
'parameters': {'$numberDouble': 'NaN'}}},
'averageNumberOfOperationsPerPath': {0: 1.2857142857142851,
1: 1.266666666666666,
2: 1.266666666666666,
3: 3.333333333333333,
4: 3.333333333333333},
'api_spec_id': {0: 84, 1: 84, 2: 84, 3: 124, 4: 124}})
I want to extract the values for column methods in different dataframes, like get, post, put with their values underneath. What would be the best way to achieve this?
I tried using eval() function and something like this `
df1 = df.pop('methods').str.strip('{').str.split(':',expand=True).astype(float)
but did not work either. Any suggestions what I should be using instead?