str.upper() str.lower() str.title(): Convert the cases of the font.


Youtube Live session on Tkinter

import pandas as pd 
my_dict={'NAME':['Ravi','Raju','Alex']}
df = pd.DataFrame(data=my_dict)
print(df.NAME.str.upper()) # convert Lower case to Upper case 
Output
0    RAVI
1    RAJU
2    ALEX

lower() : Upper case to Lower case

import pandas as pd 
my_dict={'NAME':['Ravi','Raju','Alex']}
df = pd.DataFrame(data=my_dict)
print(df.NAME.str.lower())
Output
0    ravi
1    raju
2    alex

title(): First char of each word to Upper case

import pandas as pd 
my_dict={'NAME':['ravi ron','raju geek','alex john']}
df = pd.DataFrame(data=my_dict)
print(df.NAME.str.title())
Output
0     Ravi Ron
1    Raju Geek
2    Alex John

capitalize(): First Char to Upper case

import pandas as pd 
my_dict={'NAME':['ravi ron','raju geek','alex john']}
df = pd.DataFrame(data=my_dict)
print(df.NAME.str.capitalize())
Output
0     Ravi ron
1    Raju geek
2    Alex john

swapcase(): Convert Lower to Uppper and Upper to Lower case

import pandas as pd 
my_dict={'NAME':['Ravi Ron','Raju Geek','Alex John']}
df = pd.DataFrame(data=my_dict)
print(df.NAME.str.swapcase())
Output
0     rAVI rON
1    rAJU gEEK
2    aLEX jOHN


Pandas contains() split() slice()
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer