0

I`ve got the DataFrame with nested json inside the extra_data column

My df

when I try to use pd.json_normalize(transactions['extra_data']) I get a 'str' object has no attribute 'values' error. Is there any way to solve this? The dataframe is taken straight from the database, so that`s not a csv file or something

Alexey
  • 1

1 Answers1

0

Most likely values in extra_data column are str, not deserialized JSON. try

import json

df['extra_data']  = df['extra_data'].apply(json.load)
df = pd.json_normalize(df['extra_data'])
buran
  • 13,682
  • 10
  • 36
  • 61