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: DTI.freqstr raises AttributeError when freq is None #7606

Merged
merged 1 commit into from Jun 29, 2014

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Jun 29, 2014

DatetimeIndex.freqstr raises AttributeError if freq/offset is None, even though docstring says "return the frequency object as a string if its set, otherwise None"

idx = pd.DatetimeIndex(['2011-01-01', '2011-01-02', '2011-01-03', '2011-01-04'])
idx.freqstr
# AttributeError: 'NoneType' object has no attribute 'freqstr'

Also, DataFrame/Series.to_period has a logic to use inferred_freq when the freq is not passed, but it doesn't work actually because of the bug. Moved the logic to DatetimeIndex.to_period for consistency and made it works.

The fix will simplify #7602 a little.

@jreback jreback added this to the 0.14.1 milestone Jun 29, 2014
jreback added a commit that referenced this pull request Jun 29, 2014
BUG: DTI.freqstr raises AttributeError when freq is None
@jreback jreback merged commit 0db1ef2 into pandas-dev:master Jun 29, 2014
@jreback
Copy link
Contributor

jreback commented Jun 29, 2014

thanks!

fixes r gr8!

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

Successfully merging this pull request may close these issues.

None yet

2 participants