Student
Student

Reputation: 1197

How do I get Pandas to recognize a *.zip file?

Objective: I want to read a CSV file contained in a *.zip file

My problem is that Python acts as there is not file.

FileNotFoundError: [Errno 2] No such file or directory: 'N:\\l\\xyz.zip'

The code I am using is the below (using a windows machine):

import pandas as pd
data = pd.read_csv(r"N:\l\xyz.zip",
                  compression="zip")

Any help would be appreciated?

data = pd.read_csv("N:\l\xyz.zip",
                  compression="zip")

EDIT:This is on an s3 bucket.

Upvotes: 0

Views: 355

Answers (1)

Bishu
Bishu

Reputation: 26

I have used below code for the zipped file in working directory & it worked

df = pd.read_csv("test_wbcd.zip", compression="zip")

So, the problem should be with the file path. Kindly check your file location.

Upvotes: 1

Related Questions