Answer to Question #283356 in Python for ramk

Question #283356

Write a Pandas program to convert all the string values to upper, lower cases in a given pandas series. Also find the length of the string values.


1
Expert's answer
2021-12-30T15:18:13-0500
import pandas as pd
import numpy as np
str_line = pd.Series(['A', 'B', 'c', 'd' 'AaBb', 'CcDd', 'HELLO', None, 'phone', 'charge', 'BOOk'])
print("Original series:")
print(str_line)


print("\nConvert all string values of the said Series to upper case:")
print(str_line.str.upper())


print("\nConvert all string values of the said Series to lower case:")
print(str_line.str.lower())


print("\nLength of the string values of the said Series:")
print(str_line.str.len()) 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS