You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’ve been following the pandas-nightly workflow failures and noticed the AssertionError in test_map_meta. I have my local dev environment set up (Python 3.10) and I'd like to help investigate this.
I'm going to try and isolate a minimal reproducible example to see if this is caused by a change in how pandas 3.0 handles index metadata or if it's a dask_expr specific logic change. I'll post my findings here shortly!
Now that pandas 3.0 final is out, main CI is failing with
FAILED dask/dataframe/io/tests/test_parquet.py::test_filter_nonpartition_columns[pyarrow-pyarrow-True] - pandas.errors.Pandas4Warning: Constructing a Categorical with a dtype and values containing non-null entries not in that dtype's categories is deprecated and will raise in a future version.
I don't recall seeing dask/dataframe/dask_expr/tests/test_collection.py::test_len. Can you post a full traceback and any investigation you're able to do?
I don't recall seeing dask/dataframe/dask_expr/tests/test_collection.py::test_len. Can you post a full traceback and any investigation you're able to do?
Debugging details
To understand the failure, I added debug prints just before the first assertion in test_map_meta:
print(f"DEBUG - RESULT META INDEX: {result._meta.index}")
print(f"DEBUG - EXPECTED INDEX: {expected.index}")
Observed output
DEBUG - RESULT META INDEX: RangeIndex(start=0, stop=0, step=1)
DEBUG - EXPECTED INDEX: RangeIndex(start=0, stop=100, step=1)
The test then fails at:
assert result._meta.index.equals(expected.index)
Interpretation
This indicates that when calling: df.x.map(lambda x: x + 1, meta=expected.iloc[:0])
the resulting _meta does not preserve the index information from the provided meta. Instead, _meta.index is inferred as an empty RangeIndex(0, 0), even though the supplied meta carries the full index type.
This reproduces the CI failure and suggests that index handling during _meta inference for Series.map has changed (or regressed) with pandas 3.0.
To me it smells of a race condition within pandas where different dask threads have different values and categories in their stacks and they call categories.get_indexer_for(values) in parallel, but they may share a common global state and thus interfere with each other. It reminds me of pydata/xarray#10923.
However, just like the other issue I just linked, I'm utterly failing to reproduce it locally - either synthetically or with the dask test suite.
FAILED dask/dataframe/io/tests/test_parquet.py::test_arrow_partitioning - pandas.errors.Pandas4Warning: Constructing a Categorical with a dtype and values containing non-null entries not in that dtype's categories is deprecated and will raise in a future version.
Because I failed to replicate the failures on the GIL-enabled interpreter, I cannot assertively say if these race conditions are a regression in Pandas 3.0 or if they were already there in 2.3. I can only observe from git blame that Index._ensure_mapping_populated has not been touched in at least 3 years.
Activity
Moksha25-tech commentedon Jan 18, 2026
I’ve been following the pandas-nightly workflow failures and noticed the AssertionError in test_map_meta. I have my local dev environment set up (Python 3.10) and I'd like to help investigate this.
I'm going to try and isolate a minimal reproducible example to see if this is caused by a change in how pandas 3.0 handles index metadata or if it's a dask_expr specific logic change. I'll post my findings here shortly!
Can you assign this issue to me?
jacobtomlinson commentedon Jan 22, 2026
@Moksha25-tech we don't assign issues to non-core members here. But please feel free to take a look!
cc @TomAugspurger who has also been looking at this
TomAugspurger commentedon Jan 22, 2026
Sorry, I forgot to push up #12243 earlier.
crusaderky commentedon Jan 23, 2026
Now that pandas 3.0 final is out, main CI is failing with
TomAugspurger commentedon Jan 23, 2026
@crusaderky do you have a link to a failure? https://github.com/dask/dask/actions/runs/21265711624/job/61204242073 is a recent run from main that passed.
crusaderky commentedon Jan 23, 2026
@TomAugspurger https://github.com/dask/dask/actions/runs/21276378399/job/61236740674
Briefly looking at the test, I see a random.choice in it, which would explain why the warning only appears occasionally.
nullr0ute commentedon Jan 24, 2026
I'm seeing a couple of failures when testing the panda 3.0 upgrade in Fedora:
FAILED dask/dataframe/dask_expr/tests/test_collection.py::test_map_meta - AssertionError: Series.index are different FAILED dask/dataframe/dask_expr/tests/test_collection.py::test_len - AssertionError: assert 100 == 10 = 2 failed, 16059 passed, 1230 skipped, 336 xfailed, 282 xpassed, 28 warnings in 446.83s (0:07:26) =TomAugspurger commentedon Jan 24, 2026
I suspect that was fixed by #12243.
I don't recall seeing
dask/dataframe/dask_expr/tests/test_collection.py::test_len. Can you post a full traceback and any investigation you're able to do?crusaderky commentedon Jan 24, 2026
It appeared before: 🤓 #12191 (comment)
Moksha25-tech commentedon Jan 25, 2026
Reproduction of test_map_meta failure with pandas 3.0
I was able to reproduce the failure locally in test_map_meta when testing against pandas 3.0.
Environment
Python 3.12.3
pytest 9.0.2
pandas 3.0
local checkout of main
Command used
Debugging details
To understand the failure, I added debug prints just before the first assertion in test_map_meta:
Observed output
The test then fails at:
assert result._meta.index.equals(expected.index)
Interpretation
This indicates that when calling:
df.x.map(lambda x: x + 1, meta=expected.iloc[:0])the resulting _meta does not preserve the index information from the provided meta. Instead, _meta.index is inferred as an empty RangeIndex(0, 0), even though the supplied meta carries the full index type.
This reproduces the CI failure and suggests that index handling during _meta inference for Series.map has changed (or regressed) with pandas 3.0.
crusaderky commentedon Feb 3, 2026
Looking at it closer, I'm reading
which makes no sense.
I can trigger the warning with
To me it smells of a race condition within pandas where different dask threads have different values and categories in their stacks and they call
categories.get_indexer_for(values)in parallel, but they may share a common global state and thus interfere with each other. It reminds me of pydata/xarray#10923.However, just like the other issue I just linked, I'm utterly failing to reproduce it locally - either synthetically or with the dask test suite.
crusaderky commentedon Feb 3, 2026
Possible root cause: race condition in
pd.Index._ensure_mapping_populated: pandas-dev/pandas#63685crusaderky commentedon Feb 3, 2026
New flakiness in
dask/dataframe/io/tests/test_parquet.py::test_roundtrip_partitioned_pyarrow_datasetalso may have the same root cause:https://github.com/dask/dask/actions/runs/21628536686/job/62334916154?pr=12266
crusaderky commentedon Feb 4, 2026
I've just observed this on a 3.10 environment, which is stuck on pandas 2.3.
crusaderky commentedon Feb 4, 2026
This also looks caused by pandas-dev/pandas#63685:
crusaderky commentedon Feb 5, 2026
I've tested pandas-dev/pandas#63783 vs. pandas git tip on 3.14 and 3.14t (#12284).
TL;DR; the pandas PR seems to make all flakiness disappear, and I consider it a blocker to 3.14t support for dask.dataframe.
Shared based environments
pandas variants
mamba install pandas=3.0.0 --force-reinstallpip install git+https://github.com/pandas-dev/pandas.git@2455fb9066628929be67011d01bb62a098cdb9eapip install git+https://github.com/crusaderky/pandas.git@727c73034f9d2c63d7e0164a10c2f5e367b017c6Test run
These are tests that are frequently seen to fail in our CI throughout all Python versions:
Outcome
Because I failed to replicate the failures on the GIL-enabled interpreter, I cannot assertively say if these race conditions are a regression in Pandas 3.0 or if they were already there in 2.3. I can only observe from git blame that
Index._ensure_mapping_populatedhas not been touched in at least 3 years.