Skip to content

Conversation

jbrockmendel
Copy link
Member

Copy link
Member

@phofl phofl left a comment

Choose a reason for hiding this comment

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

lgtm

@lithomas1 lithomas1 added the Reduction Operations sum, mean, min, max, etc. label Nov 23, 2021
@lithomas1 lithomas1 added this to the 1.4 milestone Nov 23, 2021
)
def diff(self, periods: int = 1, axis: Axis = 0) -> DataFrame:
if not isinstance(periods, int):
if not lib.is_integer(periods):
Copy link
Contributor

Choose a reason for hiding this comment

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

pandas/core/frame.py:8616: error: "int" has no attribute "is_integer" [attr-defined]

Copy link
Member Author

Choose a reason for hiding this comment

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

that's pretty weird, looks like a mypy problem to me

Copy link
Contributor

Choose a reason for hiding this comment

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

My bad, this actually refers to the line below if not (is_float(periods) and periods.is_integer()):.

with pytest.raises(ValueError, match="periods must be an integer"):
df.diff(1.5)

def test_diff_allows_np_integer(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

fine, could just parameterize the below one

Copy link
Member Author

Choose a reason for hiding this comment

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

not wild about this as it is, but it looks like the next test could use a good splitting, after which combining might make more sense

Copy link
Contributor

Choose a reason for hiding this comment

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

kk add to list :->

@jreback jreback merged commit 8c17c1b into pandas-dev:master Nov 23, 2021
@jbrockmendel jbrockmendel deleted the bugs branch November 23, 2021 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reduction Operations sum, mean, min, max, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: diff method raises ValueError when it's called with np.int64
4 participants