Reputation: 45
frame = pd.DataFrame()
for i in range (1995,2020):
file_name = f"{i}"
df = pd.read_csv(BytesIO(uploaded["%s.csv"%file_name]))
df = pd.DataFrame(data, columns= ['DATE','ARANGALI'])
frame.append(df)
print(frame)
I tried to define a function to append all the the data I have into one dataframe. The output appears to be an empty dataframe.
Empty DataFrame; Columns: []; Index: [].
The code works if consider the variables frame and df as lists and appends up to a large list. But I want a dataframe with all the data under the same column heads. What am I doing wrong?
Upvotes: 0
Views: 121