How to merge all csv files in a folder?

For example, if each user information is a separate csv file, now I want to merge all the user information into one csv file. I tried a lot of Python writing methods, the effect is not very ideal, and finally solved with a line of commands in cmd, the effect is equivalent to concat (axis=1) in python (ie vertical stitching).

Steps:

  • 1.Make sure all csv files are in one folder.

  • 2.Open the cmd compiler and use “cd” to enter the folder where the csv is stored.(You can also hold down shift in the csv folder and click the right mouse button to open the command window here.)

  • 3.Enter the following command;

copy *.csv merge.csv

(‘merge’ is the name of the generated file, you can name it yourself.)

  • 4.Then press enter and the terminal dialog box shows the progress. After the end, open the csv folder and you can see merge.csv

ReferenceMerge CSV Files Into One Large CSV File In Windows 7