2

I used to use the pandas command: pd.read_csv('path copied from studio lab') to read the csv file but now this same command seems to not work anymore. The path that I used in the pandas command I got by right-clicking on the upload filed and then selecting copy path.

Any help?

The error message:

FileNotFoundError: [Errno 2] No such file or directory: 'Titanic/train.csv'

Guga
  • 21
  • 1

1 Answers1

0

You can use boto3 to read the files

#pip install boto3

import boto3
s3 = boto3.client('s3')
obj = s3.get_object(
         Bucket = 'bucket_name',
         Key = 'path/to/file.csv'
      )
df = pd.read_csv(obj['Body'], nrows=100)

check few samples using nrows to make sure you see the data you were expecting.