简体   繁体   中英

IOError: [Errno 13] Permission denied Pandas

I am trying to load a dataset and at first I was getting an error code that said :

pandas.errors.ParserError: Error tokenizing data. C error: Calling read(nbytes) on source failed. Try engine='python'.

Then I added the engine = 'python' so my code looks like this for reference:

import pandas as pd

pd.set_option('display.max_rows',500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width',1000)
ccr = pd.read_csv('D:/Users/vguevara/ExternalScripts/Colaberry/PythonClass/Consumer_complaints.csv', engine = 'python', sep=',' )
print (ccr)

Now I get this error code:

IOError: [Errno 13] Permission denied

None of the previous answers to other threads helped, any idea? Thanks.

Traceback:

Traceback (most recent call last):
  File "D:\Users\vguevara\ExternalScripts\Colaberry\PythonClass\Script14Lab.py", line 8, in <module>
    ccr = pd.read_csv('D:/Users/vguevara/ExternalScripts/Colaberry/PythonClass/Consumer_complaints.csv', engine = 'python', sep=',' )
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 702, in parser_f
    return _read(filepath_or_buffer, kwds)
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 429, in _read
    parser = TextFileReader(filepath_or_buffer, **kwds)
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 895, in __init__
    self._make_engine(self.engine)
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 1132, in _make_engine
    self._engine = klass(self.f, **self.options)
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 2238, in __init__
    self.unnamed_cols) = self._infer_columns()
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 2510, in _infer_columns
    line = self._buffered_line()
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 2689, in _buffered_line
    return self._next_line()
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 2794, in _next_line
    orig_line = self._next_iter_line(row_num=self.pos + 1)
  File "c:\Python27\lib\site-packages\pandas\io\parsers.py", line 2854, in _next_iter_line
    return next(self.data)
IOError: [Errno 13] Permission denied```

there is a permission issue in your program. you can try

sudo chmod o+r <address>

where is file it is pointing to.

for example if your error is IOError: [Errno 13] Permission denied: '/usr/local/lib/abc/xyz.txt'

then run command

sudo chmod o+r /usr/local/lib/abc/xyz.txt

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM