Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request #351 from scikit-hep/issue-348
Browse files Browse the repository at this point in the history
Support RangeIndex before and after Pandas version 0.25.
  • Loading branch information
jpivarski committed Sep 27, 2019
2 parents 33dcd91 + 6eb0d50 commit 6142d7f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion uproot/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,13 @@ def iterate(path, treepath, branches=None, entrysteps=float("inf"), outputtype=d
awkward.numpy.add(index, globalentrystart, out=index)

elif type(arrays.index).__name__ == "RangeIndex":
arrays.index = type(arrays.index)(arrays.index.start + globalentrystart, arrays.index.stop + globalentrystart)
if hasattr(arrays.index, "start") and hasattr(arrays.index, "stop"):
indexstart = arrays.index.start # pandas>=0.25.0
indexstop = arrays.index.stop
else:
indexstart = arrays.index._start # pandas<0.25.0
indexstop = arrays.index._stop
arrays.index = type(arrays.index)(indexstart + globalentrystart, indexstop + globalentrystart)

else:
if hasattr(arrays.index, "array"):
Expand Down

0 comments on commit 6142d7f

Please sign in to comment.