I tried many answers but none of them working for me:
For example this: Import multiple CSV files into pandas and concatenate into one DataFrame
import pandas as pd
import glob
import os
path = r'C:\DRO\DCL_rawdata_files' # use your path
all_files = glob.glob(os.path.join(path , "/*.csv"))
li = []
for filename in all_files:
    df = pd.read_csv(filename, index_col=None, header=0)
    li.append(df)
frame = pd.concat(li, axis=0, ignore_index=True)
I have only 2 csv files:
1.csv:
1,1
2,1
3,1
4,1
5,1
2.csv:
6,1
7,1
8,1
9,1
To be fair, this is my routine for merging:
files = glob.glob("data/*.csv")
df = []
for f in files:
    csv = pd.read_csv(f, index_col=None, header=0)
    df.append(csv)
df = pd.concat(df, axis=0, ignore_index=True)
df.to_csv("all.csv")
print(df);
This is the output (print(df)):
   1  1.1    6
0  2  1.0  NaN
1  3  1.0  NaN
2  4  1.0  NaN
3  5  1.0  NaN
4  1  NaN  7.0
5  1  NaN  8.0
6  1  NaN  9.0
And this is the "all.csv":
,1,1.1,6
0,2,1.0,
1,3,1.0,
2,4,1.0,
3,5,1.0,
4,1,,7.0
5,1,,8.0
6,1,,9.0
Whereas I would need all.csv to be:
1,1
2,1
3,1
4,1
5,1
6,1
7,1
8,1
9,1
I'm using Python3.9 with PyCharm 2022.3.1.
Why is my all.csv look like that, and how can I simply read multiple csv into one dataframe for further processing?
 
     
     
    