从S3读取CSV时,内核正在重新启动,弹出如下:
Kernel Restarting
The kernel appears to have died. It will restart automatically
以下是代码段:
import boto3
import pandas as pd
from boto.s3.connection import S3Connection
YOUR_ACCESS_KEY='******'
YOUR_SECRET_KEY='******'
YOUR_BUCKET='******'
client = boto3.client('s3',aws_access_key_id=YOUR_ACCESS_KEY, aws_secret_access_key=YOUR_SECRET_KEY)
client.download_file(YOUR_BUCKET, 'test.csv','test.csv')
从以下行引发错误:
test_df = pd.read_csv('test.csv')
但我可以访问其他文件,例如示例文本文件:
client.download_file(YOUR_BUCKET, 'sample.txt','sample.txt')
print(open('sample.txt').read())
我认为这个错误是因为CSV文件的大小很大,但是读取5MB的CSV文件会产生同样的错误。
答案 0 :(得分:0)