0

I am quite new into the python programing / data scientist world. I use Pycharm and MacOs. For learning purposes I have downloaded some CSV files from Kaggle and I am always able to load them OK into Pycharm. But actually I not able to load a csv file from my work environment, surprisingly, I can load the file using R function 'fread', but my objective is to load it into python. Find below the code and the error:

Code:

import pandas as pd
snowrawptp = pd.read_csv("/Users/oscargonzalez-lliberosperis/Desktop/SNOW raw data/SNOW PTP last year tickets_csv.csv")

Error:

"/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/venv/bin/python" "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/raw csv cleaning.py" Traceback (most recent call last): File "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/raw csv cleaning.py", line 4, in snowrawptp = pd.read_csv("/Users/oscargonzalez-lliberosperis/Desktop/SNOW raw data/SNOW PTP last year tickets_csv.csv") File "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/venv/lib/python3.7/site-packages/pandas/io/parsers.py", line 676, in parser_f return _read(filepath_or_buffer, kwds) File "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/venv/lib/python3.7/site-packages/pandas/io/parsers.py", line 448, in _read parser = TextFileReader(fp_or_buf, **kwds) File "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/venv/lib/python3.7/site-packages/pandas/io/parsers.py", line 880, in init self._make_engine(self.engine) File "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/venv/lib/python3.7/site-packages/pandas/io/parsers.py", line 1114, in _make_engine self._engine = CParserWrapper(self.f, **self.options) File "/Users/oscargonzalez-lliberosperis/PycharmProjects/VCC SNOW project/venv/lib/python3.7/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 678, in pandas._libs.parsers.TextReader._setup_parser_source OSError: Initializing from file failed

Thanks!

1
  • can you try this snowrawptp = pd.read_csv(r"your_correct_path")? Commented Apr 27, 2020 at 14:20

1 Answer 1

0

I am not very sure but try removing spaces from your folders like 'SNOW raw data' and run again. Also is 'SNOW PTP last year tickets_csv' your file name or just 'tickets_csv'? Always try avoiding spaces in folders and files.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.