append_csv_on_disk
- ssapy.io.append_csv_on_disk(csv_files, output_file)[source][source]
Append multiple CSV files into a single CSV file.
This function merges multiple CSV files into one output CSV file. The output file will contain the header row from the first CSV file and data rows from all input CSV files.
Parameters:
- csv_fileslist of str
List of file paths to the CSV files to be merged. All CSV files should have the same delimiter and structure.
- output_filestr
Path to the output CSV file where the merged data will be written.
Notes:
The function assumes all input CSV files have the same delimiter. It determines the delimiter from the first CSV file using the guess_csv_delimiter function.
Only the header row from the first CSV file is included in the output file. Headers from subsequent files are ignored.
This function overwrites the output file if it already exists.
Example:
>>> csv_files = ['file1.csv', 'file2.csv', 'file3.csv'] >>> output_file = 'merged_output.csv' >>> append_csv_on_disk(csv_files, output_file) Completed appending of: merged_output.csv.
Dependencies:
guess_csv_delimiter function: A utility function used to guess the delimiter of the CSV files.
csv module: Standard library module used for reading and writing CSV files.