0

I don't know whats going wrong but I am not able to import a simple .csv file into my colab workspace.

I've written the following code:

# set the url of the data
data_url =r'C:\Users\Startklar\Desktop\20210709_CL1_PX_SETTLE.csv'

# read the alphabet data
cl1_data = pd.read_csv(data_url, sep=';')

and the system always tells me the following error message:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-79-1e0d246819b0> in <module>()
      3 
      4 # read the alphabet data
----> 5 cl1_data = pd.read_csv(data_url, sep=';')

4 frames
/usr/local/lib/python3.7/dist-packages/pandas/io/parsers.py in __init__(self, src, **kwds)
   2008         kwds["usecols"] = self.usecols
   2009 
-> 2010         self._reader = parsers.TextReader(src, **kwds)
   2011         self.unnamed_cols = self._reader.unnamed_cols
   2012 

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader.__cinit__()

pandas/_libs/parsers.pyx in pandas._libs.parsers.TextReader._setup_parser_source()

FileNotFoundError: [Errno 2] No such file or directory: `'C:\\Users\\Startklar\\Desktop\\20210709_CL1_PX_SETTLE.csv'`

I am absolutely sure that the url is right and of course the file exists in the path mentioned. What's wrong?

martineau
  • 119,623
  • 25
  • 170
  • 301

1 Answers1

-2

You might wanna change the url slightly.

filepath = "C:\\Users\\DELL\\txt.csv"

Helps python parse the filepath and reach it via colab or jupyter ntbk. The second line of code seems appropriate

RJ Adriaansen
  • 9,131
  • 2
  • 12
  • 26
  • 3
    The use of `r'C:\blah\blah'` to specify a raw string already resolved the need to again escape the back slashes. – ifly6 Jul 12 '21 at 20:09