Комментарии:
Amazing! Thank you!
ОтветитьDidn't work for me!
ОтветитьBrilliant. Thank you so much.
ОтветитьIt worked for me!
thank you
Brilliant! Worked perfectly
ОтветитьIt worked for me!
Ответитьit didn't work .. i have this error:There is not enough space on the disk.
0 file(s) copied.
can u help me?
import os
import pandas as pd
folder_path = '/path/to/csv_folder' # Replace with the actual folder path
# Get a list of all CSV files in the folder
csv_files = [file for file in os.listdir(folder_path) if file.endswith('.csv')]
# Create an empty DataFrame to store the combined data
combined_data = pd.DataFrame()
# Iterate over the CSV files
for file in csv_files:
file_path = os.path.join(folder_path, file)
# Read the CSV file
df = pd.read_csv(file_path)
# Append the data to the combined DataFrame
combined_data = combined_data.append(df, ignore_index=True)
# Save the combined data to a CSV file
combined_file_name = 'combined_data.csv'
combined_data.to_csv(combined_file_name, index=False)
print(f"Combined data saved to '{combined_file_name}'.")
It didn’t work for me either.
ОтветитьFor some reason this doesn't work anymore, been doing it for years, but suddenly stopped, any idea why?
ОтветитьThanks for the Tip
Ответить