Several posts explain how to loop through a folder, or to extract all (or:specific) files from a given zip, or to create a pandas data frame from several CSVs in a file. Alas I am lacking experience to combine all these code snippets into something that works - Can someone help me, please?
What I currently have:
import gzip
import csv
import json
import pandas as pd
path =r'C:\\Users\\folder_with_zipped_files'
File_List= glob.glob(path + "/*.csv.gz")
frame = pd.DataFrame()
list_ = []
for file_ in File_List:
df = pd.read_csv(File_List, compression='gzip', header=0,sep=',', error_bad_lines=False)
collectfiles.append(df)
allfiles = pd.concat(collectfiles)
This throws the Error:
ValueError: Invalid file path or buffer object type: <class 'list'>
Thanks a million for any advice and help -it's much appreciated!