Python Forum
Read csv file through PyCharm
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read csv file through PyCharm
Dear Madam/Sir,

I am beginner to learn python programming through Pycharm. I tried to import csv file thorough Pycharm and current working directory is ‘C:\Users\hakjo\PycharmProjects\jm1’ and python file name is ‘’. When I run the following program, I repeatedly have error messages.
I read many postings related to relative vs. absolute path and I don’t see any problem to set the absolute path where ‘sentiment-test.crv’ file is stored. It will be highly appreciated if you can help me to fix this error.

import pandas as pd

C:\Users\hakjo\PycharmProjects\jm1\venv\Scripts\python.exe C:/Users/hakjo/PycharmProjects/jm1/
Traceback (most recent call last):
** File “C:\Users\hakjo\PycharmProjects\jm1\”, line 6, in **
** df=pd.read_csv(r’C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.crv’)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\”, line 311, in wrapper**
** return func(args, kwargs)
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\”, line 586, in read_csv*
** return _read(filepath_or_buffer, kwds)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\”, line 482, in _read**
** parser = TextFileReader(filepath_or_buffer, kwds)
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\”, line 811, in init**
** self._engine = self._make_engine(self.engine)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\”, line 1040, in _make_engine**
** return mapping[engine](self.f, self.options) # type: ignore[call-arg]
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\”, line 51, in init**
** self._open_handles(src, kwds)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\”, line 222, in _open_handles**
** self.handles = get_handle(**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\”, line 701, in get_handle**
** handle = open(**
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.crv’

Process finished with exit code 1

Thank you so much
Hi Joon,
Please read BBCode to learn how to post code and output.
FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.crv’
The message seems quite clear. Does the file "C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.crv" exist and is it readable? Can you open it with notepad.exe? Should the name not be "C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.csv"?
You can test the file exists,

import os
import pandas as pd
myfile = r"C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.crv"
if os.path.isfile(myfile):
    print(f"file {myfile} does not exist")
maybe you can also use

myfile = "C:/Users/hakjo/PycharmProjects/m1/sentiment-test.crv"
Cross-post on SO:
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.

Possibly Related Threads…
Thread Author Replies Views Last Post
  Why it does not print( Rejaul84 1 398 Jul-01-2021, 10:37 PM
Last Post: bowlofred
  Read and write active Excel file euras 4 530 Jun-29-2021, 11:16 PM
Last Post: Pedroski55
  [Solved] Trying to read specific lines from a file Laplace12 7 768 Jun-21-2021, 11:15 AM
Last Post: Laplace12
  [Solved] Using readlines to read data file and sum columns Laplace12 4 508 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  guys please help me , pycharm is not able to identify my xlsx file CrazyGreenYT7 1 411 Jun-13-2021, 02:22 PM
Last Post: Larz60+
  Read file, reformat and write new file bryanmartin113 1 512 Jun-08-2021, 09:27 PM
Last Post: Larz60+
  Read/Write binary file deanhystad 3 931 Feb-01-2021, 10:29 AM
Last Post: Larz60+
  how to change the range of read CSV file every time python file runs greenpine 6 997 Dec-08-2020, 10:11 PM
Last Post: greenpine
  How to read CSV file one row at the time in a range and some delay in between greenpine 2 1,505 Nov-20-2020, 02:26 PM
Last Post: greenpine
  can't read QRcode in large file simoneek 0 610 Sep-16-2020, 08:52 AM
Last Post: simoneek

Forum Jump:

User Panel Messages

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