-1
os.chdir("..")

weather_df = pd.read_csv("C:\Users\admin\Desktop\weatherHistory.csv")
 File "<ipython-input-29-7f8013c3f0c4>", line 3
    weather_df = pd.read_csv("C:\Users\admin\Desktop\weatherHistory.csv")
                            ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Axisnix
  • 2,822
  • 5
  • 19
  • 41

1 Answers1

0

\ is a special character, which must be escaped. For example, \n specifies a new line.

So instead of \ write \\ in the path. Or write an r in front of the quotation marks: r""

weather_df = pd.read_csv("C:\\Users\\admin\\Desktop\\weatherHistory.csv")

or

weather_df = pd.read_csv(r"C:\Users\admin\Desktop\weatherHistory.csv")
Daniel
  • 1,426
  • 1
  • 11
  • 24