pandas.Series.str.get
-
Series.str.get(i)[source] -
Извлечение элемента из каждого компонента в заданной позиции.
Извлечение элемента из списков, кортежей или строк в каждом элементе Series/Index.
Параметры: -
i : int -
Позиция элемента для извлечения.
Возвращает: -
items : Series/Index of objects
Примеры
>>> s = pd.Series(["String", (1, 2, 3), ["a", "b", "c"], 123, -456, {1:"Hello", "2":"World"}]) >>> s 0 String 1 (1, 2, 3) 2 [a, b, c] 3 123 4 -456 5 {1: 'Hello', '2': 'World'} dtype: object>>> s.str.get(1) 0 t 1 2 2 b 3 NaN 4 NaN 5 Hello dtype: object
>>> s.str.get(-1) 0 g 1 3 2 c 3 NaN 4 NaN 5 NaN dtype: object
-
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.Series.str.get.html