Skip to content

Conversation

akshat62
Copy link

@akshat62 akshat62 commented Jun 28, 2025

…g non-numeric types

@@ -1334,9 +1334,15 @@ def diff(arr, n: int, axis: AxisInt = 0):
# added a check on the integer value of period
# see https://github.com/pandas-dev/pandas/issues/56607
if not lib.is_integer(n):
if not (is_float(n) and n.is_integer()):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont understand how this happens. n.is_integer should only be called when is_float(n), which should be equivalent to isinstance(n, (float, np.float_). so the method should always exist

@mroeschke
Copy link
Member

Thanks for this PR but closing per #61728 (comment)

@mroeschke mroeschke closed this Jun 30, 2025
@akshat62 akshat62 deleted the bug-61728/attribute-error-diff branch August 12, 2025 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: AttributeError in pandas.core.algorithms.diff when passing non-numeric types
3 participants