Q:

Write a Pandas program to calculate the number of characters in each word in a given series

0

Write a Pandas program to calculate the number of characters in each word in a given series

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import pandas as pd
series1 = pd.Series(['Php', 'Python', 'Java', 'C#'])
print("Original Series:")
print(series1)
result = series1.map(lambda x: len(x))
print("\nNumber of characters in each word in the said series:")
print(result)

Sample Output:

Original Series:
0       Php
1    Python
2      Java
3        C#
dtype: object

Number of characters in each word in the said series:
0    3
1    6
2    4
3    2
dtype: int64

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now