Pandas

Pandas (19)

Jun's N 2022. 8. 10. 22:02

How to calculate the number of characters in each word in a series?

# Input
ser = pd.Series(['how', 'to', 'kick', 'ass?'])

# Solution
ser.map(lambda x: len(x))

#output
0    3
1    2
2    4
3    4
dtype: int64
728x90