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

Adding DataFrames with offsets yields naive index #500

Closed
craustin opened this issue Dec 16, 2011 · 2 comments
Closed

Adding DataFrames with offsets yields naive index #500

craustin opened this issue Dec 16, 2011 · 2 comments
Labels
Milestone

Comments

@craustin
Copy link

Adding two DataFrames with a DateRange index (with BusinessMonthEnd offset) yields a DataFrame with a simple 'Index'.

@craustin
Copy link
Author

from pandas import DateRange, DataFrame
from pandas.core.datetools import BMonthEnd
a = DataFrame({}, index=DateRange('2011-01-01', '2011-11-30', offset=BMonthEnd()))
b = DataFrame({}, index=DateRange('2011-01-01', '2011-11-29', offset=BMonthEnd()))
print a+b

Yields:
Empty DataFrame
Columns: Index([], dtype=object)
Index: Index([2011-01-31 00:00:00, 2011-02-28 00:00:00, 2011-03-31 00:00:00,
2011-04-29 00:00:00, 2011-05-31 00:00:00, 2011-06-30 00:00:00,
2011-07-29 00:00:00, 2011-08-31 00:00:00, 2011-09-30 00:00:00,
2011-10-31 00:00:00, 2011-11-30 00:00:00], dtype=object)

In Pandas 0.4.0, yields:
Empty DataFrame
class 'pandas.core.daterange.DateRange'
offset: 1 BusinessMonthEnd, tzinfo: None
[2011-01-31 00:00:00, ..., 2011-11-30 00:00:00]
length: 11

Note, this doesn't just happen with empty DataFrames - I just did that for a simple repro.

wesm added a commit that referenced this issue Dec 17, 2011
@wesm
Copy link
Member

wesm commented Dec 17, 2011

Fixed in the above commit

@wesm wesm closed this as completed Dec 17, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants