Skip to content

API: argsort behaviour for ExtensionArray with missing values #21801

Closed
@jorisvandenbossche

Description

@jorisvandenbossche

Currently we don't specify what the behaviour should be for ExtensionArray.argsort when there are missing values.
This is not a huge problem because the Series.sort_values deals with the missing values itself (only argsorts the non-missing data), but still we should pin down and test the behaviour.

I suppose we should follow numpy's example here and put them last (which is also consistent with the default behaviour of sort_values):

In [114]: a = np.array([1, 3, 2, np.nan, 4, np.nan])

In [115]: a.argsort()
Out[115]: array([0, 2, 1, 4, 3, 5])

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions