(unicode error) 'un...
 
Share:
Notifications
Clear all

[Solved] (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape - Getting this Error in PySpark How to resolve this?


myTechMint
(@mytechmint)
Member Moderator
Joined: 1 year ago
Posts: 31
Topic starter  

[Answer]

This error occurs because you are using a normal string as a path. You can use one of the three following solutions to fix your problem:

Just put r before your normal string it converts normal string to raw string:

pandas.read_csv(r"C:\Users\mytechmint\Desktop\data_file.csv")

OR

pandas.read_csv("C:/Users/mytechmint/Desktop/data_file.csv")

OR

pandas.read_csv("C:\\Users\\mytechmint\\Desktop\\data_file.csv")

Quote
Topic Tags