Facebook
From Whipped Treeshrew, 3 Years ago, written in Python.
This paste is a reply to Re: merge csv to one from Mustard Kangaroo - go back
Embed
Viewing differences between Re: merge csv to one and Re: Re: merge csv to one
all_data raw_data pd.DataFrame()

  for filename in all_files:
    df = pd.
[pd.read_csv(filename, index_col='Date', header=0)
    all_data 
header=0) for filename in all_files]
raw_data 
= pd.concat([all_data, df], axis=0)
    
    print(f'size before: {len(df.index)}')
    # Remove dupli
    # https://stackoverflow.com/questions/13035764/remove-pandas-rows-with-duplicate-indices/14900065#14900065
    df = df[~df.index.duplicated(keep='first')]
    #
    df.to_csv("filename.
concat(raw_data, axis=0)
print(f'Size: {raw_data.shape[0]}')
raw_data.to_csv("raw_data.
csv", index = False, header=True)index=False)