A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/pandas-docs/stable/user_guide/../reference/api/pandas.Series.str.get.html below:

pandas.Series.str.get — pandas 2.3.1 documentation

pandas.Series.str.get#
Series.str.get(i)[source]#

Extract element from each component at specified position or with specified key.

Extract element from lists, tuples, dict, or strings in each element in the Series/Index.

Parameters:
iint or hashable dict label

Position or key of element to extract.

Returns:
Series or Index

Examples

>>> 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    None
dtype: object

Return element with given key

>>> s = pd.Series([{"name": "Hello", "value": "World"},
...               {"name": "Goodbye", "value": "Planet"}])
>>> s.str.get('name')
0      Hello
1    Goodbye
dtype: object

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4