I am working on a Jupyter notebook from AWS EMR.
I am able to do this:
pd.read_csv("s3:\mypath\xyz.csv')
.
However, if I try to open a pickle file like this, pd.read_pickle("s3:\mypath\xyz.pkl")
I am getting this error:
JavaScript
x
12
12
1
[Errno 2] No such file or directory: 's3://pvarma1/users/users/candidate_users.pkl'
2
Traceback (most recent call last):
3
File "/usr/local/lib64/python2.7/site-packages/pandas/io/pickle.py", line 179, in read_pickle
4
return try_read(path)
5
File "/usr/local/lib64/python2.7/site-packages/pandas/io/pickle.py", line 177, in try_read
6
lambda f: pc.load(f, encoding=encoding, compat=True))
7
File "/usr/local/lib64/python2.7/site-packages/pandas/io/pickle.py", line 146, in read_wrapper
8
is_text=False)
9
File "/usr/local/lib64/python2.7/site-packages/pandas/io/common.py", line 421, in _get_handle
10
f = open(path_or_buf, mode)
11
IOError: [Errno 2] No such file or d
12
However, I can see both xyz.csv
and xyz.pkl
in the same path! Can anyone help?
Advertisement
Answer
Pandas read_pickle
supports only local paths, unlike read_csv
. So you should be copying the pickle file to your machine before reading it in pandas.