Pandas Series: str.upper() function
Series-str.upper() function
The str.upper() function is used to convert strings in the Series/Index to uppercase.
Equivalent to str.upper().
Syntax:
Series.str.upper(self)
Returns: Series/Index of objects
Example:
Python-Pandas Code:
import numpy as np
import pandas as pd
s = pd.Series(['long', 'CAPTAIN', 'this is a car', 'FoOtBaLl'])
s
Output:
0 long 1 CAPTAIN 2 this is a car 3 FoOtBaLl dtype: object
Python-Pandas Code:
import numpy as np
import pandas as pd
s = pd.Series(['long', 'CAPTAIN', 'this is a car', 'FoOtBaLl'])
s.str.upper()
Output:
0 LONG 1 CAPTAIN 2 THIS IS A CAR 3 FOOTBALL dtype: object
Previous: Series-str.title() function
Next: Series-str.wrap() function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/pandas/series/series-str-upper.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics