Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

API: boolean ops with float dtype #61881

Open
Labels
API - ConsistencyInternal Consistency of API/Behavior Needs DiscussionRequires discussion from core team before further action Nullable by defaultIssues that would be addressed by moving to nullable-by-default Numeric OperationsArithmetic, Comparison, and Logical operations
@jbrockmendel

Description

# from #60234 OP
ser1 = pd.Series([False, False])
ser2 = pd.Series([0.0, 0.1])
ser1 | ser2 # <- works by casting floats to bool
ser2 | ser1 # <- raises TypeError
# We also have special-casing for NaNs among floats
ser3 = pd.Series([np.nan, 1.0])
ser3 & ser3 # <- raises bc you can't do float & float
ser3[:-1] & ser3[:-1] # has no non-NaN floats so we special-case

logical ops (&, |, ^) have inconsistent behavior. I think we should simplify this significantly and more closely resemble the numpy behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    API - ConsistencyInternal Consistency of API/Behavior Needs DiscussionRequires discussion from core team before further action Nullable by defaultIssues that would be addressed by moving to nullable-by-default Numeric OperationsArithmetic, Comparison, and Logical operations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /