1

I created a df to read a csv in my jupyter notebook library but for some reason the i'm getting an error like this:

FileNotFoundError: [Errno 2] File b'file path/filename.csv' does not exist: b'/file path/filename.csv'

My code is this:

df_csv = pd.read_csv('../file_path/file_name.csv', low_memory=False)

I believe I am using the absolute path to this file...I also checked the directory to confirm I was using the correct path.

import os

print(os.path.abspath('file_name.csv'))

and the output was:

/YXRwLW5vdGVib29rLW5pbmd1eWVuLXNlc3Npb24teGJ1YQ==/file_path/file_name.csv

Is that not the same as '../file_path/file_name.csv'? Would appreciate any troubleshooting tips...

I am not sure why this worked but instead of using the absolute path I used the relative path and just read the file name...A bit concerned with this method since I'd rather be explicit

bananas
  • 133
  • 8
  • What OS are you using? – Jason Baker Nov 02 '22 at 05:31
  • I am using a Windows 10 – bananas Nov 02 '22 at 05:46
  • Does anyone understand what this part of the os abspath was? "/YXRwLW5vdGVib29rLW5pbmd1eWVuLXNlc3Npb24teGJ1YQ==" – bananas Nov 02 '22 at 19:31
  • @bananas Could you please add the information about Python and Pandas version you are using? – medium-dimensional Nov 03 '22 at 06:06
  • 1
    The error message shows a different file name than your code. Also the `b'...'` indicates that this is a byte string, not a regular string. How could that possibly have happened? Please review the [help] and in particular [How to ask](/help/how-to-ask) as well as the guidance for providing a [mre]. We probably need to see the full traceback for a start, but it also needs to correspond to exactly the code you are asking about. – tripleee Nov 03 '22 at 06:14

0 Answers0