Removing lower case letter in column of Pandas dataframe
You can update the name
column by making use of .str.replace(..)
[pandas-doc]:
df['Name'] = df['Name'].str.replace('[a-z]', '')
For the given sample data, this gives us:
>>> df['Name'].str.replace('[a-z]', '')
0 TOM
1 NICK
2 KRISH
3 JACK
Name: Name, dtype: object
You can try this too if you don't like RegEx:
df['Name'].apply(lambda x: ''.join([letter for letter in x if letter.isupper()]))
For all rows in the Name
column, concatenate all letters that are uppercase.