1

I am trying to read a CSV file from a Windows path but can't read file or folders that contain t, b as their starting letter.

For example, in the line below (in bold text):

 df = pd.read_csv("G:\Datasets **\t**raining-blackfriday-Q1-Q4 **\b**lackfriday.csv",sep=",")

I get:

FileNotFoundError: [Errno 2] File b'/data/training/SECTION1.csv' does not exist: b'/data/training/SECTION1.csv'
Gino Mempin
  • 25,369
  • 29
  • 96
  • 135
Moditya
  • 11
  • 1
  • 1
    You need to use raw strings: https://stackoverflow.com/a/44941695/2745495 – Gino Mempin Feb 29 '20 at 04:01
  • `\t` and `\n` (and few other chars) have special meaning in strings so you have to use \\ instead of all \ . OR use prefix `r` to create raw string `r"G:\..."`. Sometimes you can use / instead of \ in path in Windows but not all tools may respect it. – furas Feb 29 '20 at 05:10

0 Answers0