0

Hey I'm looking for answers which can be solve my issue.

1.I have a csv files in one folder 2.Excel files in other folder 3.I want combine these two folder files as a single file

Note : Data is same in both folder files in terms of columns

  • 1
    Suppose we have a/a1.csv, b/b1.xlsx and b/b2.xlsx, are you looking to concatenate the rows in all 3 files one below the other? Could you edit the description to explain how you want to combine these files please? – S Anand Apr 08 '22 at 06:56

1 Answers1

0
  1. For file handling I recommend using the pathlib built-in python module: pathlib examples. Use the glob method to fetch all files with a given ending - .csv and .xslx
  2. Next you can use pandas to open the csv and .xslx files - check these examples for csv files, for excel files
  3. Once you load the data into dataframes, you can combine them into one dataframe. If necessary do some data manipulation on the columns.
  4. And lastly you can export the combined dataframe into a csv file - use the pd.to_csv() method - documentation on the method