简体   繁体   中英

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,

熊猫str.upper也可以。

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM