Linked Questions

Popular Questions

Trying to expand nested List of Dictionaries in Column

Asked by At

I am trying to expand the column "Records" in my dataframe that is a nested list of dictionaries I am trying to extract the columns: Product, interest, Id, Company, Deal, Date, Family,Amount, Currency


 10    [{u'Product': u'Ops', u'interest': 
      None, u'Id': u'78827dhdgsg', u'Company': u'Panda', 
      u'attributes': {u'type': u'Lead', u'url': 
      u'Deal': u'xxx6787', u'Date': 
      u'2018-12-03', u'Family': u'Ops', 
      u'Amount': 9300, u'Currency': u'USD'}]

         [{u'Product': u'gold', 
  5    u'interest': None, u'Id': u'377ffh38', 
      u'Company': u'BIGPT', u'attributes': {u'type': u'Lead', u'url': 
      u'Deal': u'wakft', u'Date': 
      u'2015-10-17', u'Family': u'bugs', 
      u'Amount': 48889, u'Currency': u'USD'}]

I've tried

pd.concat([pd.DataFrame(x) for x in data['']],keys=data.index).reset_index(level=1,drop=True)

This used to work but for some reason I keep getting error, ValueError: DataFrame constructor not properly called!

Size Product Interest Id   Company  Deal  Date     Family  Amount Currency

10   Ops             7882.. Panda xxx.. 2018-12-03   Ops     9300  USD 
5    Ops             377ff..BIGPT wakft 2015-10-17   Bugs   48889  USD

Related Questions