Hi,
I was trying to merge two csv files and it worked BUT the first column of the beginning of the merged file starts with a "," (see image). Any ideas?
Thanks
code
I was trying to merge two csv files and it worked BUT the first column of the beginning of the merged file starts with a "," (see image). Any ideas?
Thanks
code
from os import chdir
from glob import glob
import pandas as pdlib
def merge_csv(list_raw_files, file_out):
# Consolidate all CSV files into one object
result_obj = pdlib.concat([pdlib.read_csv(file) for file in list_raw_files])
# Convert the above object into a csv file and export
result_obj.to_csv(file_out, index=False, encoding="utf-8")
# Move to the path that holds our CSV files
file_folder = 'my_path'
chdir(file_folder)
# List all CSV files in the working dir
list_raw_files = [f for f in listdir(file_folder) if isfile(join(file_folder, f))]
#print(list_raw_files)
file_out = "merged_file.csv"
merge_csv(list_raw_files, file_out)
