diff --git a/src/uproot/interpretation/library.py b/src/uproot/interpretation/library.py index fc6947fd0..c79c2f2c3 100644 --- a/src/uproot/interpretation/library.py +++ b/src/uproot/interpretation/library.py @@ -919,7 +919,12 @@ def global_index(self, arrays, global_offset): ) else: - index = arrays.index.arrays + # arrays.index.values before Pandas 0.24 and again now; + # arrays.index.arrays from Pandas 0.24 through some time ago. + if hasattr(arrays.index, "values"): + index = arrays.index.values + else: + index = arrays.index.arrays numpy.add(index, global_offset, out=index) return arrays diff --git a/tests/test_1321_pandas_changed_api_again.py b/tests/test_1321_pandas_changed_api_again.py new file mode 100644 index 000000000..5dcf46168 --- /dev/null +++ b/tests/test_1321_pandas_changed_api_again.py @@ -0,0 +1,20 @@ +# BSD 3-Clause License; see https://github.com/scikit-hep/uproot5/blob/main/LICENSE + +import pytest +import skhep_testdata +import uproot + +pytest.importorskip("pandas") + + +def test(): + assert ( + len( + uproot.concatenate( + skhep_testdata.data_path("uproot-Zmumu.root"), + library="pd", + cut="Run > 148029", + ) + ) + == 1580 + )