分类: Python/Ruby
2022-12-28 17:39:46
import pandas as pd
def plus_dir_manycsv(csv_dir, save_path): try: excels = [pd.read_csv(os.path.join(csv_dir, fname),index_col=0,encoding="utf-8") for fname in os.listdir(csv_dir) if 'csv' in fname] df = pd.concat(excels) df.to_csv(os.path.join(save_path,"adjust_plus.csv")) except Exception as e: print(csv_dir + str(e))
2. window系统上多个csv文件的合并, 暂时没有去掉多余的标题行:
copy csv_dir/*.csv save_path/hebing.csv