Answer the question
In order to leave comments, you need to log in
Merging exel and csv files using pandas?
Hello Habr family!!!
There is an .xlsx file of such content.
There is also a .csv file.
How can I combine both files into .xlsx format in such a way
that the data would be added to subsequent columns with each entry ???
At the same time, the number of lines may differ for each entry!
file_csv = pd.read_csv("temp") # .csv
file_exel = pd.read_excel(old_filename) # Присутствует Unnamed
appended_df = pd.concat([file_csv, file_exel], axis=1)
appended_df.to_excel('result.xlsx', index=False)
Answer the question
In order to leave comments, you need to log in
If we are talking about the fact that the first line gets the names "Unnamed ...", then this is because it is trying to determine the names of the columns, but there are none. In this case, the easiest way is to disable headers altogether by adding header=None to all functions (file upload and download)
file_csv = pd.read_csv("temp", header=None)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question