Skip to content

Commit

Permalink
FEAT: Add partial support for df.pct_change() [UPSTREAM] (modin-pro…
Browse files Browse the repository at this point in the history
…ject#21)

* FEAT: Add partial support for df.pct_change()
  • Loading branch information
Karthik Velayutham authored and vnlitvinov committed Apr 12, 2023
1 parent 4ab527d commit 3bc29a2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2065,6 +2065,15 @@ def pct_change(
"""
Percentage change between the current and a prior element.
"""
# Attempting to match pandas error behavior here
if not isinstance(periods, int):
raise ValueError(f"periods must be an int. got {type(periods)} instead")

# Attempting to match pandas error behavior here
for dtype in self._get_dtypes():
if not is_numeric_dtype(dtype):
raise TypeError(f"unsupported operand type for /: got {dtype}")

return self.__constructor__(
query_compiler=self._query_compiler.pct_change(
periods=periods,
Expand Down

0 comments on commit 3bc29a2

Please sign in to comment.