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: combine_first behaves strangely with period index #3367

Closed
kiroh opened this issue Apr 15, 2013 · 11 comments · Fixed by #7741
Closed

BUG: combine_first behaves strangely with period index #3367

kiroh opened this issue Apr 15, 2013 · 11 comments · Fixed by #7741
Labels
Bug Period Period data type
Milestone

Comments

@kiroh
Copy link

kiroh commented Apr 15, 2013

If i do:

from pandas import Series, PeriodIndex, Period

pi = PeriodIndex(start=Period('1950-1'), freq='M', end=Period('1950-7'))
a = Series([1,nan,nan,4,5,nan,7], pi)
b = Series([9,9,9,9,9,9,9], pi)

display(a, b, a.combine_first(b))

Then the output is:

1950-01     1
1950-02   NaN
1950-03   NaN
1950-04     4
1950-05     5
1950-06   NaN
1950-07     7
Freq: M

1950-01    9
1950-02    9
1950-03    9
1950-04    9
1950-05    9
1950-06    9
1950-07    9
Freq: M

1930-01   NaN
1930-03   NaN
1930-05   NaN
1930-07   NaN
1930-09   NaN
1930-11   NaN
1931-01   NaN
Freq: M

As you can see the index is changed and the values are all gone.
I think this is a bug. My Pandas version is 0.10.1.

@ghost
Copy link

ghost commented Apr 15, 2013

I can't reproduce this with git master, can you try 0.11.0rc1 and see if the problem persists?

@kiroh
Copy link
Author

kiroh commented Apr 15, 2013

Ok, is there any way to try 0.11.0rc1 without breaking my 0.10.1 installation?

@ghost
Copy link

ghost commented Apr 15, 2013

You can use a virtualenv.

@jreback
Copy link
Contributor

jreback commented Apr 15, 2013

@y-p occurs in 0.11.0rc1 too, same result....

@ghost
Copy link

ghost commented Apr 15, 2013

Oh my bad, I'm working with an old version. apperently it worked fine in '0.8.0.dev-092fedc'.

@jreback
Copy link
Contributor

jreback commented Apr 15, 2013

looking at code, its not going to work....mark for bug in 0.12 (only affects PeriodIndex), DatetimeIndex works fine

@ghost
Copy link

ghost commented Apr 15, 2013

bisected? what broke it?

@jreback
Copy link
Contributor

jreback commented Apr 15, 2013

no idea when broken (obviously >0.8.0<0.10.1)

@jreback jreback closed this as completed Jan 3, 2014
@cganterh
Copy link

cganterh commented Jan 3, 2014

It's fixed?

@jreback
Copy link
Contributor

jreback commented Jan 3, 2014

@cganterh sorry...i think got accidently closed

@jreback jreback reopened this Jan 3, 2014
@jreback jreback modified the milestones: 0.15.0, 0.14.0 Mar 14, 2014
@sinhrks
Copy link
Member

sinhrks commented Jul 19, 2014

Current master raises TypeError: unsupported operand type(s) for +: 'PeriodIndex' and 'PeriodIndex'. #7741 will fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Period Period data type
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants