To calculate the numbers of characters we use Series.str.len(). This function returns the count of the characters in each word in a series.
Return type: Series of integer values. NULL values might be present too depending upon caller series.
Another way to find the number of characters by using len() function (that wrapped inside the map function) so that the given series substitutes the value of length by taking series of data as input using pandas.series().
Let’s see some examples:
Example 1: We take input of words and count each character of words with the help of Series.map() that substitute the values and gives output using a function named as calc.
Example 3: To print in a specific format of word with its length.
- Pandas - Convert the first and last character of each word to upper case in a series
- Calculate the frequency counts of each unique value of a Pandas series
- Python | Pandas Series.mad() to calculate Mean Absolute Deviation of a Series
- Add a Pandas series to another Pandas series
- Python program to read file word by word
- Python IMDbPY – Get each episode name of each season of the series
- Python IMDbPY – Getting each episode year of each season of the series
- Python IMDbPY – Get each episode ID of each season of the series
- Python | Pandas series.cumprod() to find Cumulative product of a Series
- Python | Pandas Series.str.replace() to replace text in a series
- Python | Pandas Series.astype() to convert Data type of series
- Python | Pandas Series.cumsum() to find cumulative sum of a Series
- Python | Pandas series.cummax() to find Cumulative maximum of a series
- Python | Pandas Series.cummin() to find cumulative minimum of a series
- Python | Pandas Series.nonzero() to get Index of all non zero values in a series
- Convert a series of date strings to a time series in Pandas Dataframe
- Convert Series of lists to one Series in Pandas
- Converting Series of lists to one Series in Pandas
- Pandas - Get the elements of series that are not present in other series
- Python | Reverse each word in a sentence
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.