Reputation: 1891
I am trying to remove special characters from a string, but when I export the Pandas dataframe as a CSV, I can still see the special characters.
Does anyone know why that is?
Current Code:
document = json.dumps(jfile,default=str)
document2 = re.sub("[“â£$€™]", '', document)
document2 = json.loads(document2)
document2.to_csv("test.csv", index = False)
Output (special character still found in CSV file):
Upvotes: 0
Views: 185
Reputation: 450
This seems the pandas Encoding problem. Try to read/load your file with the appropriate encoding.
Upvotes: 2