Python: to_csv for decoded dataframe
This looks like a character-encoding problem, make sure your CSV file is opened as 'UTF-8' or other compatible encoding, not ASCII, as 'спасо-преображенский собор' are cyrillic and not latin characters.
I have a text file that has encoded strings.
I am decoding them using urllib.parse.unquote(string_df.encoded_string) and storing it in a dataframe.
I want to export this dataframe to a text file.
However, it just adds garbage values.
For example:
Encoded String: %D1%81%D0%BF%D0%B0%D1%81%D0%BE-%D0%BF%D1%80%D0...
Decoded using urllib.parse.unquote : спасо-преображенский собор
Exported value in text file: ?????-?????????????? ?????
I have tried exporting in an excel file using to_excel but when I open the excel file, it gives illegal character error.
Also tried using numpy.savetxt but it gives the same ?????-?????????????? ?????.
Anyway I can export it to a flat file and still have the desired "спасо-преображенский собор" result?