Pandas : Lets read multiple zipped CSV’s in one go !!

This short snippet of a python script which I find very handy to read multiple CSV in one go.

import pandas as pd
import numpy as np
import glob
import os

file_list = []
for filepath in glob.iglob('C:/StoreItem/Daily/Store/Sales_*_10_01_04_*.zip'):

raw_data = pd.concat([pd.read_csv(f,parse_dates=['Time_ID'],compression='zip') for f in file_list], ignore_index = True)

Leave a Reply

Your email address will not be published. Required fields are marked *