pandas.Series.at

Access a single value for a row/column label pair.

Similar to loc, in that both provide label-based lookups. Use at if you only need to get or set a single value in a DataFrame or Series.

raises
KeyError

When label does not exist in DataFrame

Limitations

  • This function may reveal slower performance than Pandas* on user system. Users should exercise a tradeoff

    between staying in JIT-region with that function or going back to interpreter mode.

Examples

With a scalar integer. Returns single value.
import numpy as np
import pandas as pd
from numba import njit


@njit
def series_at_value():
    series = pd.Series([5, 4, 3, 2, 1], index=[0, 2, 4, 6, 8])

    return series.at[4]  # Expect array: [3]


print(series_at_value())
$ python ./series/series_at/series_at_single_result.py
[3]
With a scalar integer. Returns multiple value.
import numpy as np
import pandas as pd
from numba import njit


@njit
def series_at_many_idx():
    series = pd.Series([5, 4, 3, 2, 1], index=[0, 2, 0, 6, 0])

    return series.at[0]  # Expect array: [5 3 1]


print(series_at_many_idx())
$ python ./series/series_at/series_at_multiple_result.py
[5 3 1]

See also

DataFrame.iat

Access a single value for a row/column pair by integer position.

DataFrame.loc

Access a group of rows and columns by label(s).

Series.at

Access a single value using a label.