I've multiple json that I want to convert into a single csv with pandas. Here's my code:
import json
import os
import pandas as pd
data = []
for file in os.listdir("json"):
if file.endswith(".json"):
print(file)
data = json.load(open(os.path.join("json", file)))
df = pd.json_normalize(data, 'items')
print(df)
data.append(df)
temp = pd.concat(data, ignore_index = True) #concat different dataframe
temp.to_csv("output.csv", index=False, sep='\t', encoding="utf-8") #write to csv file
But I get this error: data.append(df)
AttributeError: 'dict' object has no attribute 'append'
What am I doing wrong? In all the documentation and examples I've studied it seems the right thing to do.