Skip to content

API: New callable indexing makes storing functions in a Series difficult #13299

Closed
@evanpw

Description

@evanpw

Example of something that previously worked (before 7bbd031):

>>> s = pd.Series([lambda x: x] * 10)
>>> s[s.index > 5] = lambda x: x + 1

But now the second line tries to apply the function in the rhs to the elements of the Series, rather than assigning them (and throws an exception). This is very counter-intuitive when using __setitem__ rather than calling Series.where directly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignIndexingRelated to indexing on series/frames, not to indexes themselvesRegressionFunctionality that used to work in a prior pandas version

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions