This is my csv files witch existent on a specific directory:
output0 output1 output3 output4 out0 out1 out2 out3
I should merge output0 with out0 , output1 with out1 ect ..
I merged just output0 with out0 but i did not find a way to do this with all the files
PS: this is an exemple I have 100 csv files in my directory
This is my code:
import pandas as pd import time a = pd.read_csv("C:/Users/AQ42770/Documents/merge/outdoctor0.csv") b = pd.read_csv("C:/Users/AQ42770/Documents/merge/output0.csv") merged = a.merge(b, on='Class') merged.to_csv("output.csv", index=False) time.sleep(60) df = pd.read_csv("output.csv") k=df.loc[~df.Class.duplicated(keep='last')] k.to_csv("test1.csv", index=False, na_rep='NaN')