dataset1 = pl.readparquet("C:\Users\nguye4tg\Downloads\dfhist.parquet") dataset2 =…
- User
dataset1 = pl.read_parquet("C:\Users\nguye4tg\Downloads\df_hist.parquet") dataset2 = pl.read_parquet("C:\Users\nguye4tg\Downloads\newitem.parquet") dataset3 = pl.read_parquet("C:\Users\nguye4tg\Downloads\lowvol_newitem.parquet")shape: (10, 4) MaterialID SalesOrg DistrChan CL4 i64 str i64 str 12420784 "US01" 8 "6067208" 12403251 "US01" 8 "1131041" 12470041 "US01" 8 "1131041" 12435649 "US01" 8 "5076999" 12486097 "US02" 8 "5641467" 11002371 "US01" 10 "6665052" 12042380 "US01" 9 "5339180" 12229940 "US01" 8 "5076999" 12305403 "US03" 8 "1131037" 12377619 "US01" 10 "6173867" shape: (10, 5) MaterialID SalesOrg DistrChan CL4 Item Type i64 str i64 str str 12420784 "US01" 8 "6067208" "Low Volume" 12403251 "US01" 8 "1131041" "Low Volume" 12470041 "US01" 8 "1131041" "Low Volume" 12435649 "US01" 8 "5076999" "Low Volume" 12486097 "US02" 8 "5641467" "Low Volume" 11002371 "US01" 10 "6665052" "Low Volume" 12042380 "US01" 9 "5339180" "Low Volume" 12229940 "US01" 8 "5076999" "Low Volume" 12305403 "US03" 8 "1131037" "Low Volume" 12377619 "US01" 10 "6173867" "Low Volume" Cell In[3], line 1 dataset1 = pl.read_parquet("C:\Users\nguye4tg\Downloads\df_hist.parquet") ^ SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
- Assistant
The error you are encountering is because of the way Python interprets backslashes (
\) in strings. In Python strings, backslashes are used as escape characters, which is why the path is not being correctly interpreted. For example,\Uin the string is being interpreted as the beginning of a Unicode escape sequence.To fix this, you have several options:
- Use raw strings by prefixing the string literal with an
rto prevent escape sequence processing:
pythondataset1 = pl.read_parquet(r"C:\Users\nguye4tg\Downloads\df_hist.parquet") dataset2 = pl.read_parquet(r"C:\Users\nguye4tg\Downloads\newitem.parquet") dataset3 = pl.read_parquet(r"C:\Users\nguye4tg\Downloads\lowvol_newitem.parquet") - Use raw strings by prefixing the string literal with an