This is my code snippet:
import os
import pandas as pd
path = os.getcwd()
files = os.listdir(path)
df = []
for f in files:
data = pd.read_csv(f, usecols = [0,1,2,3,4])
df.append(data)
temp = pd.concat(df)
where df is a list of dataframes:
0
DataFrame
(1, 5)
1
DataFrame
(7, 5)
2
DataFrame
(5, 5)
3
DataFrame
(10, 5)
4
DataFrame
(1, 5)
5
DataFrame
(2, 5)
I'm trying to stack these dataframes below one another and get one single dataframe as output. I've tried a bunch of combinations from SO Q&A but none seems to work. I feel this is easy. What am I doing wrong?