import pandas as pd import zipfile zf = zipfile.ZipFile('C:/Users/Desktop/THEZIPFILE.zip') # if you want to see all files inside zip folder zf.namelist() # now read your csv file df = pd.read_csv(zf.open('intfile.csv'))
Here is what the above code is Doing:
1. zf = zipfile.ZipFile(‘C:/Users/Desktop/THEZIPFILE.zip’)
– This is creating a zipfile object called zf.
– This is printing out all the files inside the zip folder.
3. df = pd.read_csv(zf.open(‘intfile.csv’))
– This is creating a dataframe called df from the csv file inside the zip folder.