Pandas version checks

  • [x] I have checked that this issue has not already been reported.

  • [x] I have confirmed this bug exists on the latest version of pandas.

  • [ ] I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import pandas as pd
df = pd.DataFrame({'a': [3,6,1,1,None,6]}, dtype='Int64[pyarrow]')
df['a_mask'] = df['a'].isna()
print(df.groupby('a_mask').rank(method='min'))

Issue Description

On Windows, this outputs

      a
0   4.0
1   1.0
2   1.0
3   1.0
4  <NA>
5   5.0

Expected Behavior

On Linux, it outputs

      a
0   3.0
1   4.0
2   1.0
3   1.0
4  <NA>
5   4.0

Installed Versions

Windows:

INSTALLED VERSIONS ------------------ commit : c888af6d0bb674932007623c0867e1fbd4bdc2c6 python : 3.11.9 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.26100 machine : AMD64 processor : Intel64 Family 6 Model 141 Stepping 1, GenuineIntel byteorder : little LC_ALL : None LANG : None LOCALE : English_United Kingdom.1252 pandas : 2.3.1 numpy : 2.3.1 pytz : 2025.2 dateutil : 2.9.0.post0 pip : None Cython : None sphinx : None IPython : 9.4.0 adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None blosc : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : None html5lib : None hypothesis : 6.135.32 gcsfs : None jinja2 : 3.1.6 lxml.etree : None matplotlib : None numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None psycopg2 : None pymysql : None pyarrow : 21.0.0 pyreadstat : None pytest : 8.4.1 python-calamine : None pyxlsb : None s3fs : None scipy : None sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlsxwriter : None zstandard : None tzdata : 2025.2 qtpy : None pyqt5 : None

Linux:

INSTALLED VERSIONS ------------------ commit : c888af6d0bb674932007623c0867e1fbd4bdc2c6 python : 3.12.8 python-bits : 64 OS : Linux OS-release : 6.6.87.2-microsoft-standard-WSL2 Version : #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 machine : x86_64 processor : x86_64 byteorder : little LC_ALL : None LANG : C.UTF-8 LOCALE : C.UTF-8 pandas : 2.3.1 numpy : 2.3.1 pytz : 2025.2 dateutil : 2.9.0.post0 pip : None Cython : None sphinx : None IPython : 9.1.0 adbc-driver-postgresql: None adbc-driver-sqlite : None bs4 : None blosc : None bottleneck : None dataframe-api-compat : None fastparquet : None fsspec : 2025.7.0 html5lib : None hypothesis : 6.135.32 gcsfs : None jinja2 : 3.1.6 lxml.etree : None matplotlib : 3.10.3 numba : None numexpr : None odfpy : None openpyxl : None pandas_gbq : None psycopg2 : None pymysql : None pyarrow : 21.0.0 pyreadstat : None pytest : 8.4.1 python-calamine : None pyxlsb : None s3fs : None scipy : 1.16.0 sqlalchemy : None tables : None tabulate : None xarray : None xlrd : None xlsxwriter : None zstandard : None tzdata : 2025.2 qtpy : None pyqt5 : None

Comment From: MarcoGorelli

Note that downgrading PyArrow to version 20 resolves this

I think this may be related to the PyArrow 21 release from 9 hours ago? https://pypi.org/project/pyarrow/21.0.0/

Comment From: rhshadrach

Took a quick look over the changelog for PyArrow 21, nothing jumped out. It'd probably be helpful to narrow down what functionality caused this. From Windows, are you able to post the output of:

df = pd.DataFrame({'a': [3,6,1,1,None,6]}, dtype='Int64[pyarrow]')
df['a_mask'] = df['a'].isna()
gb = df.groupby('a_mask')
print(df['a_mask'])
print(gb._grouper.result_index)
print(gb._grouper.codes)
print(gb._grouper.groupings[0].codes)

If the result_index / codes look right, my best guess it's something ArrowExtensionArray._groupby_op.

Comment From: MarcoGorelli

sure, here you go

0    False
1    False
2    False
3    False
4     True
5    False
Name: a_mask, dtype: bool
Index([False, True], dtype='bool', name='a_mask')
[array([0, 0, 0, 0, 1, 0])]
[0 0 0 0 1 0]