Skip to content

Index.map followups #18482

Closed
Closed
@jreback

Description

@jreback
Contributor

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')

Activity

added
IndexingRelated to indexing on series/frames, not to indexes themselves
IntervalInterval data type
Testingpandas testing functions or related to the test suite
on Nov 25, 2017
added this to the 0.22.0 milestone on Nov 25, 2017
jreback

jreback commented on Nov 25, 2017

@jreback
ContributorAuthor

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

added a commit that references this issue on Nov 25, 2017
jschendel

jschendel commented on Nov 26, 2017

@jschendel
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

jschendel commented on Nov 26, 2017

@jschendel
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

jreback commented on Nov 26, 2017

@jreback
ContributorAuthor

@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).

added a commit that references this issue on Nov 26, 2017
jorisvandenbossche

jorisvandenbossche commented on Nov 27, 2017

@jorisvandenbossche
Member

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

jreback

jreback commented on Nov 27, 2017

@jreback
ContributorAuthor

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

jorisvandenbossche

jorisvandenbossche commented on Nov 27, 2017

@jorisvandenbossche
Member

Ah, I forgot that one :-)

modified the milestones: 0.23.0, Next Major Release on Apr 14, 2018
louispotok

louispotok commented on May 2, 2018

@louispotok
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

jschendel commented on May 2, 2018

@jschendel
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

louispotok commented on May 2, 2018

@louispotok
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

jschendel commented on May 2, 2018

@jschendel
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.

added
Testingpandas testing functions or related to the test suite
IndexRelated to the Index class or subclasses
and removed
Testingpandas testing functions or related to the test suite
IndexingRelated to indexing on series/frames, not to indexes themselves
on Jun 29, 2019
mroeschke

mroeschke commented on Oct 7, 2019

@mroeschke
Member

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

jschendel

jschendel commented on Oct 9, 2019

@jschendel
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    API DesignBugIndexRelated to the Index class or subclassesIntervalInterval data typeTestingpandas testing functions or related to the test suite

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @jreback@jorisvandenbossche@toobaz@jschendel@louispotok

        Issue actions

          Index.map followups · Issue #18482 · pandas-dev/pandas