Skip to content

Index.map followups #18482

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

Closed
2 of 3 tasks
jreback opened this issue Nov 25, 2017 · 13 comments
Closed
2 of 3 tasks

Index.map followups #18482

jreback opened this issue Nov 25, 2017 · 13 comments
Labels
API Design Bug Index Related to the Index class or subclasses Interval Interval data type Testing pandas testing functions or related to the test suite

Comments

@jreback
Copy link
Contributor

jreback commented Nov 25, 2017

xref #15081, a couple of issues

In [2]: pd.date_range('20130101', periods=3).map({})
Out[2]: Float64Index([nan, nan, nan], dtype='float64')

In [3]: pd.Index([1,2,3]).map({})
Out[3]: Float64Index([nan, nan, nan], dtype='float64')
@jreback jreback added API Design Bug Indexing Related to indexing on series/frames, not to indexes themselves Interval Interval data type Testing pandas testing functions or related to the test suite labels Nov 25, 2017
@jreback jreback added this to the 0.22.0 milestone Nov 25, 2017
@jreback
Copy link
Contributor Author

jreback commented Nov 25, 2017

cc @jorisvandenbossche (point 3)
cc @jschendel (point 1)

jreback added a commit to jreback/pandas that referenced this issue Nov 25, 2017
@jschendel
Copy link
Member

Regarding point 1: To be clear, the underlying issue referenced here is #16410, right? test_map xpasses locally for me, and that was the closest thing I could find based on the xfail message. The problem described in #16410 is still occurring, but I haven't immediately been able to produce any errors with map using a similar setup.

@jschendel
Copy link
Member

Side note: should mapping an empty dictionary against an IntervalIndex return an IntervalIndex? Currently returns a Float64Index, which seems kind of strange:

In [2]: pd.interval_range(0, 4).map({})
Out[2]: Float64Index([nan, nan, nan, nan], dtype='float64')

@jreback
Copy link
Contributor Author

jreback commented Nov 26, 2017

@jschendel I just noticed that test_interval.py/test_map is xfailed. It might have been disabled during this re-factoring. if that is the case, then just need to re-eable.

#18491 fixes all of the Indexes to return correctly there own type if {} is passed. I think II should do the same (but again still xfailed).

jreback added a commit to jreback/pandas that referenced this issue Nov 26, 2017
@jorisvandenbossche
Copy link
Member

@jreback Is there a specific reason you pinged me for point 3 ? (apart from general attention)

@jreback
Copy link
Contributor Author

jreback commented Nov 27, 2017

@jorisvandenbossche no, you had raised the point in the original issue (note this is all now resolved by #18491)

@jorisvandenbossche
Copy link
Member

Ah, I forgot that one :-)

@jreback jreback modified the milestones: 0.23.0, Next Major Release Apr 14, 2018
@louispotok
Copy link
Contributor

(I don't know if this is the right place to put this, happy to open a new issue if that's better.)

According to my reading of this PR, the following should work as of 0.22.0:

s = pd.Series({0:'a',1:'b'})
s.index.map(pd.Series({0:'c',1:'d'})) 

But for me it throws a ValueError. Whereas this works fine:

s = pd.Series({0:'a',1:'b'})
pd.Series(s.index).map(pd.Series({0:'c',1:'d'}))```

@jschendel
Copy link
Member

@louispotok : The PR you linked to has a milestone of 0.23.0, so the behavior should only work as of that release (should be relatively soon):

In [2]: pd.__version__
Out[2]: '0.23.0rc2'

In [3]: s = pd.Series({0:'a',1:'b'})

In [4]: s.index.map(pd.Series({0:'c',1:'d'}))
Out[4]: Index(['c', 'd'], dtype='object')

@louispotok
Copy link
Contributor

Oh thanks @jschendel , my mistake: I saw this event putting it in the 0.22.0, and didn't see that the milestone was later moved.

@jschendel
Copy link
Member

Ah, I was basing the 0.23.0 milestone off the right hand side summary at the top of the PR. Probably moved to 0.23.0 after the fact; the 0.22.0 release happened pretty shortly after 0.21.x and only contained one major change. Many things originally slated for 0.22.0 got moved to 0.23.0 after the being merged to accommodate the new plan for the 0.22.0 release.

@toobaz toobaz added Testing pandas testing functions or related to the test suite Index Related to the Index class or subclasses and removed Testing pandas testing functions or related to the test suite Indexing Related to indexing on series/frames, not to indexes themselves labels Jun 29, 2019
@mroeschke
Copy link
Member

@jschendel is this closable? I don't see an xfail on any test_map methods.

@jschendel
Copy link
Member

Yes, I think this can be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Bug Index Related to the Index class or subclasses Interval Interval data type Testing pandas testing functions or related to the test suite
Projects
None yet
Development

No branches or pull requests

6 participants