Home > Blockchain >  How to read csv file in pandas if the pathname contains single inverted comma and i get error?
How to read csv file in pandas if the pathname contains single inverted comma and i get error?

Time:09-04

My Code :

df1=pd.read_csv(r'C:\Users\YUNUS'S LAPTOP\Desktop\Book1.csv')
df1

Error I get :

  Input In [20]
    df1=pd.read_csv(r'C:\Users\YUNUS'S LAPTOP\Desktop\Book1.csv')
                                     ^
SyntaxError: invalid syntax

CodePudding user response:

use " rather than ' for the bonds of the string, like so

df1 = pd.read_csv(r"C:\Users\YUNUS'S LAPTOP\Desktop\Book1.csv")

  • Related