Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Series.str.len#

Series.str.len()[source]#

Compute the length of each element in the Series/Index.

The element may be a sequence (such as a string, tuple or list) or a collection(such as a dictionary).

Returns:
Series or Index of int

A Series or Index of integer values indicating the length of eachelement in the Series or Index.

See also

str.len

Python built-in function returning the length of an object.

Series.size

Returns the length of the Series.

Examples

Returns the length (number of characters) in a string. Returns thenumber of entries for dictionaries, lists or tuples.

>>>s=pd.Series(['dog',...'',...5,...{'foo':'bar'},...[2,3,5,7],...('one','two','three')])>>>s0                  dog12                    53       {'foo': 'bar'}4         [2, 3, 5, 7]5    (one, two, three)dtype: object>>>s.str.len()0    3.01    0.02    NaN3    1.04    4.05    3.0dtype: float64

[8]ページ先頭

©2009-2025 Movatter.jp