We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4444e52 commit 6a06a31Copy full SHA for 6a06a31
pandas/core/groupby/ops.py
@@ -374,6 +374,13 @@ def _call_cython_op(
374
if is_datetimelike:
375
values = values.view("int64")
376
is_numeric = True
377
+
378
+ # Fix for NaT handling: ensure NaT is treated as False in any() and all()
379
+ if self.how in ["any", "all"]:
380
+ # Set NaT (which is represented as the smallest int64) to False (0)
381
+ nat_mask = values == np.iinfo(np.int64).min
382
+ values[nat_mask] = 0 # Treat NaT as False
383
384
elif dtype.kind == "b":
385
values = values.view("uint8")
386
if values.dtype == "float16":
0 commit comments