0
votes

I have the following character: � repeated several times in a dataframe pandas and When I tried to run this command:

print(df.loc[1])

I get the following error message :

print(df.loc[3])

File "C:\Users\wwran\AppData\Local\Programs\Python\Python37\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\ufffd' in position 1: character maps to

How to get the data of the rows and columns of the dF?

1

1 Answers

0
votes

Ive just found a workarround just replacing the character in the dataframe (all of them) in 'NOMBRE Y APELLIDO' column:

df['NOMBRE Y APELLIDO'] = df['NOMBRE Y APELLIDO'].str.replace('�','N')