Edwards Marlow
Edwards Marlow

Reputation: 63

How to transform a column string from lowercase to capital letter in a data frame using python-pandas?

I am trying to convert a string column in a data frame from lowercase letter to capital letter. I only want that specific column to be modified, not the dataframe as its whole.

worker           name       hours/task    Country
constructor      Marco        7           United States
operator         Samuel       6           United States
designer         Ivgnar       5           Sweden
designer         Michael      6           Britain

the column with name 'worker'. I want its words to be turned into capital letters.

Thanks,

Upvotes: 0

Views: 653

Answers (1)

Vaishali
Vaishali

Reputation: 38415

Pandas str.upper would work as well.

df['worker'] = df['worker'].str.upper()

Upvotes: 1

Related Questions