Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix RangeIndex.get_indexer for decreasing RangeIndex #28680

Merged
merged 5 commits into from
Oct 2, 2019

Conversation

jschendel
Copy link
Member

@jschendel jschendel added Bug Indexing Related to indexing on series/frames, not to indexes themselves labels Sep 30, 2019
@jschendel jschendel added this to the 0.25.2 milestone Sep 30, 2019
@jschendel jschendel added the Regression Functionality that used to work in a prior pandas version label Sep 30, 2019
@jorisvandenbossche
Copy link
Member

@jschendel you will need to fix the conflicts now I merged the other PR

@jreback
Copy link
Contributor

jreback commented Oct 1, 2019

lgtm.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tiny comment, but mainly want you to rebase on master :-> ping on green.

doc/source/whatsnew/v0.25.2.rst Outdated Show resolved Hide resolved
@jschendel
Copy link
Member Author

@jreback : green

# GH 28678
index = RangeIndex(7, stop, -3)
result = index.get_indexer(range(9))
expected = np.array([-1, 2, -1, -1, 1, -1, -1, 0, -1], dtype=np.intp)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to have to specify np.intp here?

Copy link
Member Author

@jschendel jschendel Oct 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intp is the native numpy indexing type (see first bullet point here and this table), so we typically match that in our indexing code, and since it's platform dependent we can't specify one of the more standard type like int64 (I've broken the 32bit builds a few times by doing this!)

@jorisvandenbossche jorisvandenbossche merged commit 411dd24 into pandas-dev:master Oct 2, 2019
@jorisvandenbossche
Copy link
Member

Thanks!

meeseeksmachine pushed a commit to meeseeksmachine/pandas that referenced this pull request Oct 2, 2019
@jschendel jschendel deleted the bug-dec-ri branch October 2, 2019 16:13
galuhsahid added a commit to galuhsahid/pandas that referenced this pull request Oct 4, 2019
* master: (22 commits)
  DOC: fix PR09,PR08 errors for pandas.Timestamp (pandas-dev#28739)
  WEB: Add diversity note to team.md (pandas-dev#28630)
  DOC: Minor fixes in pandas/testing.py docstring. (pandas-dev#28752)
  TST: port maybe_promote tests from pandas-dev#23982 (pandas-dev#28764)
  Bugfix/groupby datetime issue (pandas-dev#28569)
  reenable codecov (pandas-dev#28750)
  CLN: Centralised _check_percentile (pandas-dev#27584)
  DEPR: Deprecate Index.set_value (pandas-dev#28621)
  CLN: Fix typo in contributing.rst (pandas-dev#28761)
  Fixed docstring errors in pandas.period range and pandas.PeriodIndex (pandas-dev#28756)
  BUG: Fix TypeError raised in libreduction (pandas-dev#28643)
  DOC: Pandas.Series.drop docstring PR02 (pandas-dev#27976) (pandas-dev#28742)
  DOC: Fixed doctring errors PR08, PR09 in pandas.io (pandas-dev#28748)
  TST: Fix broken test cases where Timedelta/Timestamp raise (pandas-dev#28729)
  REF: Consolidate alignment calls in DataFrame ops (pandas-dev#28638)
  BUG: Fix dep generation (pandas-dev#28734)
  Added doctstring to fixture (pandas-dev#28727)
  DOC: Fixed PR06 docstrings errors in pandas.timedelta_range (pandas-dev#28719)
  replaced safe_import with a corresponding test decorator (pandas-dev#28731)
  BUG: Fix RangeIndex.get_indexer for decreasing RangeIndex (pandas-dev#28680)
  ...
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
proost pushed a commit to proost/pandas that referenced this pull request Dec 19, 2019
bongolegend pushed a commit to bongolegend/pandas that referenced this pull request Jan 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Indexing Related to indexing on series/frames, not to indexes themselves Regression Functionality that used to work in a prior pandas version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: RangeIndex.get_indexer is incorrect for some decreasing RangeIndex
4 participants