Issue with pandas dataframe with traditional chinese
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 1.8k
- Forks
- 349
- Avg merge
- 5h 13m
- Merged PRs (30d)
- 4
Description
I have a R dataframe which contain Chinese character, but if I use pd$DataFrame(my_df),
there always an error like this:
Error in py_call_impl(callable, dots$args, dots$keywords) :
Evaluation error: Evaluation error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 14: invalid start byte
Even if I use pandas read_csv to read the file :
library(reticulate)
pd<-import('pandas')
my_df<-pd$read_csv('my_df.csv',encoding = "UTF-8")
head(my_df)
pd$DataFrame(my_df)
It still occur the same error, but the dataframe in R seems fine and Chinese character can display perfectly.
The data can be downloaded here.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the R reticulate example using pandas, pd$DataFrame, pd$read_csv, and the linked dataset containing Traditional Chinese characters. Trace where the UTF-8 UnicodeDecodeError occurs; done means the dataframe conversion succeeds while preserving the Chinese text.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python, r
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100