-
Notifications
You must be signed in to change notification settings - Fork 665
Description
Modin version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest released version of Modin.
-
I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow this guide.)
Reproducible Example
import modin.pandas as pd
df = pd.DataFrame([[1, 2]]).set_backend('pandas').astype({1: 'datetime64[ns]'})
df.groupby(0)[1].diff()
Issue Description
this would work in pandas:
import pandas as pd
df = pd.DataFrame([[1, 2]]).astype({1: 'datetime64[ns]'})
df.groupby(0)[1].diff()
Expected Behavior
should compute SeriesGroupBy.diff() like pandas
Error Logs
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[8], line 1
----> 1 pd.DataFrame(df).groupby(0)[1].diff()
File ~/sources/modin/modin/core/storage_formats/pandas/query_compiler_caster.py:1144, in wrap_function_in_argument_caster.<locals>.f_with_argument_casting(*args, **kwargs)
1141 # We have to set the global Backend correctly for I/O methods like
1142 # read_json() to use the correct backend.
1143 with config_context(Backend=result_backend):
-> 1144 result = f_to_apply(*args, **kwargs)
1145 for (
1146 original_castable,
1147 original_qc,
1148 new_castable,
1149 ) in inplace_update_trackers:
1150 new_qc = new_castable._get_query_compiler()
File ~/sources/modin/modin/logging/logger_decorator.py:149, in enable_logging.<locals>.decorator.<locals>.run_and_log(*args, **kwargs)
147 start_time = perf_counter()
148 if LogMode.get() == "disable":
--> 149 result = obj(*args, **kwargs)
150 emit_metric(metric_name, perf_counter() - start_time)
151 return result
File ~/sources/modin/modin/core/storage_formats/pandas/query_compiler_caster.py:1144, in wrap_function_in_argument_caster.<locals>.f_with_argument_casting(*args, **kwargs)
1141 # We have to set the global Backend correctly for I/O methods like
1142 # read_json() to use the correct backend.
1143 with config_context(Backend=result_backend):
-> 1144 result = f_to_apply(*args, **kwargs)
1145 for (
1146 original_castable,
1147 original_qc,
1148 new_castable,
1149 ) in inplace_update_trackers:
1150 new_qc = new_castable._get_query_compiler()
File ~/sources/modin/modin/pandas/groupby.py:1637, in DataFrameGroupBy.diff(self, periods, axis)
1635 if isinstance(self._df, Series):
1636 if not is_numeric_dtype(self._df.dtypes):
-> 1637 raise TypeError(
1638 f"unsupported operand type for -: got {self._df.dtypes}"
1639 )
1640 elif isinstance(self._df, DataFrame) and axis == 0:
1641 for col, dtype in self._df.dtypes.items():
1642 # can't calculate diff on non-numeric columns, so check for non-numeric
1643 # columns that are not included in the `by`
TypeError: unsupported operand type for -: got datetime64[ns]
Installed Versions
INSTALLED VERSIONS
commit : 60d34ac
python : 3.9.21
python-bits : 64
OS : Darwin
OS-release : 24.5.0
Version : Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:25 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T6020
machine : arm64
processor : arm
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : en_US.UTF-8
Modin dependencies
modin : 0.34.0+2.g60d34ac4
ray : 2.44.1
dask : 2024.8.0
distributed : 2024.8.0
pandas dependencies
pandas : 2.2.3
numpy : 2.0.2
pytz : 2025.2
dateutil : 2.9.0.post0
pip : 24.2
Cython : None
sphinx : 7.4.7
IPython : 8.18.1
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.13.4
blosc : None
bottleneck : None
dataframe-api-compat : None
fastparquet : 2024.11.0
fsspec : 2025.3.2
html5lib : None
hypothesis : None
gcsfs : None
jinja2 : 3.1.6
lxml.etree : 5.3.2
matplotlib : 3.9.4
numba : None
numexpr : 2.10.2
odfpy : None
openpyxl : 3.1.5
pandas_gbq : 0.28.0
psycopg2 : 2.9.10
pymysql : None
pyarrow : 18.1.0
pyreadstat : None
pytest : 8.4.0
python-calamine : None
pyxlsb : None
s3fs : 2025.3.2
scipy : 1.13.1
sqlalchemy : 2.0.40
tables : N/A
tabulate : 0.9.0
xarray : 2024.7.0
xlrd : 2.0.1
xlsxwriter : None
zstandard : None
tzdata : 2025.2
qtpy : None
pyqt5 : None