I'm trying to import an Rdata object, a named list. Most of the objects in that list work well. But one element gives me an error.
When I try to make a pandas dataframe from rpy2.robjects.vectors.DataFrame
using:
SecondObject = rpy2.robjects.pandas2ri.ri2py_dataframe(r[Name][i][j][k])
I get this error: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 34: invalid start byte
The error is caused by the text in row 131, column 2, there is this text:
'Long forward passes (span angle 90\xb0)'
type(r[Name][i][j]) gives:
rpy2.robjects.vectors.DataFrame
The second column of that particular dataframe looks like:
r[Name][i][j][1]
Out[255]:
R object with classes: ('character',) mapped to:
<StrVector - Python:0x13220e888 / R:0x7fa430ea3600>
['Air chal..., 'Ground c..., 'Ground c..., 'Air chal..., ..., 'Challeng..., 'Air chal..., 'Dribbles..., 'Tackles ...]
r[Name][i][j][1][129] succeeds, but when I try 130 I do get: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb0 in position 34: invalid start byte
Everything I tried with decoding and encoding didn't work.
When I just give python this command, python does understand the symbol from R. :
b = "Long forward passes (span angle 90\xb0)"
b
Out[258]: 'Long forward passes (span angle 90°)'
Somebody who can help me what to do?