I've created a list of csv files and cleaned them. I've been stuck on merging these lists of csv files together. Each csv file, after cleaning, have the same column labels. They also have an extra column labels. I need to merge the columns with the same name.
Here is an example of my code:
os.listdir(os.getcwd())
filelist = glob.glob('*.csv')
for file in filelist:
df = pd.read_csv(file)
#cleaning code section
print(df.head())
pd.concat(filelist)
I've tried to use pd.concat(filelist) because I though it can do that with lists but I get this
TypeError: cannot concatenate object of type '<class 'str'>'; only Series and DataFrame objs are valid
If that's the case, can I make my list into a DataFrame object or can I use something like merge or join?
Please send help!