replacing quotes, commas, apostrophes w/ regex - python/pandas
You can use str.replace
:
test['Address 1'] = test['Address 1'].str.replace(r"[\"\',]", '')
Sample:
import pandas as pd
test = pd.DataFrame({'Address 1': ["'aaa",'sa,ss"']})
print (test)
Address 1
0 'aaa
1 sa,ss"
test['Address 1'] = test['Address 1'].str.replace(r"[\"\',]", '')
print (test)
Address 1
0 aaa
1 sass
Here's the pandas solution: To apply it to an entire dataframe use, df.replace. Don't forget the \ character for the apostrophe. Example:
import pandas as pd
df = #some dataframe
df.replace('\'','', regex=True, inplace=True)