My data is like:
data = {'Sr.No.': Sr_no,
'CompanyNames': Company_Names,
'YourChoice1': ['45','45','45','45','45','45','45','45','45'],
'YourChoice2': ['45','45','45','45','45','45','45','45','45'],
'Bollinger Bands': {'Field1': ['45','45','45','45','45','45','45','45'],
'Field2': ['45','45','45','45','45','45','45','45'],
'Field3':['45','45','45','45','45','45','45','45']}
}
Which I am passing to the dataframe as:
df = pd.DataFrame(data, columns = ['Sr.No.','CompanyNames','YourChoice1','YourChoice2','Bollinger Bands'])
But I am receiving error as:
ValueError: Mixing dicts with non-Series may lead to ambiguous ordering.
Can anyone help me with this?
The CSV file should look like:
I tried the 1st solution like this:
df1 = pd.DataFrame(data, columns = ['Sr.No.', 'CompanyNames','YourChoice1','YourChoice2'])
bbands = data.pop('Bollinger Bands')
df2 = pd.DataFrame(bbands)
df = pd.concat([df1, df2], axis=1, keys=['','Bollinger Bands'])
But I have obtained the output as:
I want that 'Bollinger Bands' should be in only the first column not in all...'
The desired output is:
| | | | |Bollinger Bands| | |
|Sr.No.|Comp | | |Field1 |Field2 |Field3 |

