Skip to content

BUG: ser.to_frame().all() inconsistent with ser.all() with CategoryDtype #36076

Closed
@jbrockmendel

Description

@jbrockmendel

Based on tests.frame.test_analytics.test_any_all_np_func

ser = pd.Series([0, 1], dtype="category", name="A")
df = ser.to_frame()

>>> ser.all().
TypeError: Categorical cannot perform the operation all

>>> df.all().item()
False

Whats happening here is the DataFrame case is calling self.values which casts to int64 (avoidable with 2D EAs...).

If instead we refactor (xref #35881) to operate blockwise, this block is ignored, so we end up getting the result we'd get on an empty DataFrame, i.e. True. (xref #28900 ignoring failures is a footgun).

Expected Behavior: as long as have ignore_failures, df.all() should be True

Metadata

Metadata

Assignees

No one assigned

    Labels

    API - ConsistencyInternal Consistency of API/BehaviorNuisance ColumnsIdentifying/Dropping nuisance columns in reductions, groupby.add, DataFrame.applyNumeric OperationsArithmetic, Comparison, and Logical operationsReduction Operationssum, mean, min, max, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions