The idea is to remove full stop, commas, quotation if it is available at the beginning and last string in Pandas.
Given a df
as below
data = {'Name': ['"Tom hola.', '"nick"', 'krish here .','oh my *']}
The expected output is
Tom hola
nick
krish here
oh my
I tried the following code, but it did not work as intended
import pandas as pd
df = pd.DataFrame(data)
df['Name'] = df['Name'].str[-1:].replace({"\. ": "Na"},regex=True)
May I know how this objective can be achieved?
Also, can the approach extended for it to be applied across different columns?