Post interim dataframe transformations, if we need to place a safety mechanism to remove special random characters from complete pandas dataframe. What would be the best way ?
Example DF :
data = {'Name':['Tom', 'ni�ck', 'kri�sh�', 'ja®\u00AEck'], 'Age':[20®\u00AE, 21, 1®\u00AE9, 18]}
What would be the best way to wipe off any random special characters apart from the ASCII characters? Lambda function to run on every row and every column? Or any better way for the same ? Inspite of running df['Name'] = df['Name'].str.encode('ascii', 'ignore').str.decode('ascii')
on every individual column, any particular way to do it at global columns level?
Expected resulting DF:
Name ID
0 Tom 20FE
1 nick 21BG
2 krish 192RF
3 jack 18XR'''