Python Forum
Read csv file through PyCharm
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Read csv file through PyCharm
#1
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 ‘main.py’. 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
df=pd.read_csv(r’C:\Users\hakjo\PycharmProjects\jm1\sentiment-test.crv’)

C:\Users\hakjo\PycharmProjects\jm1\venv\Scripts\python.exe C:/Users/hakjo/PycharmProjects/jm1/main.py
Traceback (most recent call last):
** File “C:\Users\hakjo\PycharmProjects\jm1\main.py”, 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\util_decorators.py”, line 311, in wrapper**
** return func(args, kwargs)
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\readers.py”, line 586, in read_csv*
** return _read(filepath_or_buffer, kwds)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\readers.py”, line 482, in _read**
** parser = TextFileReader(filepath_or_buffer, kwds)
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\readers.py”, line 811, in init**
** self._engine = self._make_engine(self.engine)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\readers.py”, 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\c_parser_wrapper.py”, line 51, in init**
** self._open_handles(src, kwds)**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\parsers\base_parser.py”, line 222, in _open_handles**
** self.handles = get_handle(**
** File “C:\Users\hakjo\PycharmProjects\jm1\venv\lib\site-packages\pandas\io\common.py”, 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
Joon
Reply


Messages In This Thread
Read csv file through PyCharm - by kimx0961 - Jul-31-2021, 01:45 PM
RE: Read csv file through PyCharm - by ibreeden - Aug-01-2021, 08:11 AM
RE: Read csv file through PyCharm - by Axel_Erfurt - Aug-01-2021, 12:29 PM
RE: Read csv file through PyCharm - by perfringo - Aug-01-2021, 07:05 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Connecting to Remote Server to read contents of a file ChaitanyaSharma 1 378 May-03-2024, 07:23 AM
Last Post: Pedroski55
  Recommended way to read/create PDF file? Winfried 3 3,058 Nov-26-2023, 07:51 AM
Last Post: Pedroski55
  python Read each xlsx file and write it into csv with pipe delimiter mg24 4 1,750 Nov-09-2023, 10:56 AM
Last Post: mg24
  read file txt on my pc to telegram bot api Tupa 0 1,232 Jul-06-2023, 01:52 AM
Last Post: Tupa
  parse/read from file seperated by dots giovanne 5 1,225 Jun-26-2023, 12:26 PM
Last Post: DeaD_EyE
  Formatting a date time string read from a csv file DosAtPython 5 1,569 Jun-19-2023, 02:12 PM
Last Post: DosAtPython
  How do I read and write a binary file in Python? blackears 6 7,860 Jun-06-2023, 06:37 PM
Last Post: rajeshgk
  Read csv file with inconsistent delimiter gracenz 2 1,325 Mar-27-2023, 08:59 PM
Last Post: deanhystad
  Read text file, modify it then write back Pavel_47 5 1,799 Feb-18-2023, 02:49 PM
Last Post: deanhystad
  Correctly read a malformed CSV file data klllmmm 2 2,199 Jan-25-2023, 04:12 PM
Last Post: klllmmm

Forum Jump:

User Panel Messages

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