Thanks to visit codestin.com
Credit goes to github.com

Skip to content

sign for any positive timedelta should be/compare equal #8463

@gerritholl

Description

@gerritholl

The current behaviour of sign on timedelta64 objects is somewhat surprising:

In [64]: sign(np.timedelta64(3, 'm')) == sign(np.timedelta64(3, 's'))
Out[64]: False

I'm not sure if the return type for the sign of a timedelta64 should even be a timedelta64 or or simply numerical. Of course, normally sign(x) returns a result of the same dtype as x, but for any numerical data we have uint8(1) == int8(1) == float32(1) == .... etc. I'm not sure what the best return value would be for the sign of a timedelta64, but I think it would be desirable if their signs compared equal.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions