Python Forum
problem with opening csv file in pandas
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
problem with opening csv file in pandas
#1
Hello everyone,
See, I'm a Pycharm user and I'm currently learning how to use pandas for data analysis. But the problem is that I cannot open my csv file. Here is how it goes:

Code:
import pandas as pd
data = pd.read_csv('This PC\\Downloads\\sample.csv')
print(data)
Error:
Error:
Traceback (most recent call last): File "C:/Users/91960/PycharmProjects/mmm/python.py", line 2, in <module> data = pd.read_csv('This PC\\Downloads\\sample.csv','r') File "C:\Users\91960\PycharmProjects\mmm\venv\lib\site-packages\pandas\io\parsers.py", line 676, in parser_f return _read(filepath_or_buffer, kwds) File "C:\Users\91960\PycharmProjects\mmm\venv\lib\site-packages\pandas\io\parsers.py", line 448, in _read parser = TextFileReader(fp_or_buf, **kwds) File "C:\Users\91960\PycharmProjects\mmm\venv\lib\site-packages\pandas\io\parsers.py", line 880, in __init__ self._make_engine(self.engine) File "C:\Users\91960\PycharmProjects\mmm\venv\lib\site-packages\pandas\io\parsers.py", line 1114, in _make_engine self._engine = CParserWrapper(self.f, **self.options) File "C:\Users\91960\PycharmProjects\mmm\venv\lib\site-packages\pandas\io\parsers.py", line 1891, in __init__ self._reader = parsers.TextReader(src, **kwds) File "pandas\_libs\parsers.pyx", line 374, in pandas._libs.parsers.TextReader.__cinit__ File "pandas\_libs\parsers.pyx", line 674, in pandas._libs.parsers.TextReader._setup_parser_source FileNotFoundError: [Errno 2] File This PC\Downloads\sample.csv does not exist: 'This PC\\Downloads\\sample.csv'
Please help!
Reply
#2
the error message is pretty clear.
'This PC\\Downloads\\sample.csv' does not exist
looks like 'This PC' needs to be replaced with a real directory name
Reply
#3
Thanks !
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Can't read text file with pandas zinho 6 3,803 May-24-2020, 06:13 AM
Last Post: azajali43
  how to solve the 'NO SUCH DIRECTORY OR FILE' in pandas, python MohammedSohail 10 1,164 May-08-2020, 07:45 AM
Last Post: nnk
  Pandas and Date: problem with operator.How to resolve frame 6 1,687 May-13-2019, 05:50 PM
Last Post: frame
  read complex file with both pandas and not Diedro 1 963 Jan-29-2019, 05:26 PM
Last Post: Larz60+
  Load .abf file and for analysis with Pandas finalcode 0 1,084 Nov-10-2018, 09:51 AM
Last Post: finalcode
  Problem while showing a Pandas DataFrame Sirduke1 0 803 Aug-29-2018, 06:14 AM
Last Post: Sirduke1

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020