Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use the capitalize () method in Pandas

Shulou Source: shulou.com Published: 2022-06-01 14:54:23 10月04日 Update

This article introduces how to use the capitalize () method in Pandas. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

The first letter of Series.str.capitalize () is capitalized

Import pandas as pds = pd.Series ([Aaba', 'Baca',' CABA', 'dog',' cat']) print (s.str.capitalize ()) print (s.str.lower ()) print (s.str.upper ()) 0A1 B2 C3 Aaba4 Baca5 Caba6 Dog7 Catdtype: object

Series.str.lower () all lowercase

0 a1 b2 c3 aaba4 baca5 caba6 dog7 catdtype: object

Series.str.upper () all uppercase

0 A1 B2 C3 AABA4 BACA5 CABA6 DOG7 CATdtype: object

Series.str.swapcase () reverses case

0a1b2c3 aABA4 bACA5 caba6 DOG7 CATdtype: object on how to use the capitalize () method in Pandas is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Methods content uppercase more help good interest size letters guys buddies lowercase articles knowledge articles references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Redmi NVidia Shulou Tech Info