Skip to content

YearOffset() raises AttributeError #7706

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
jorisvandenbossche opened this issue Jul 9, 2014 · 5 comments
Closed

YearOffset() raises AttributeError #7706

jorisvandenbossche opened this issue Jul 9, 2014 · 5 comments
Labels
Bug Frequency DateOffsets

Comments

@jorisvandenbossche
Copy link
Member

From #7375 (comment):
related: #4804
xref: #7705 (MonthOffset)

In [55]: offsets.YearOffset()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-55-b53e59b753d1> in <module>()
----> 1 offsets.YearOffset()

c:\users\vdbosscj\scipy\pandas-joris\pandas\tseries\offsets.pyc in __init__(self
, n, normalize, **kwds)
   1331
   1332     def __init__(self, n=1, normalize=False, **kwds):
-> 1333         self.month = kwds.get('month', self._default_month)
   1334
   1335         if self.month < 1 or self.month > 12:

AttributeError: 'YearOffset' object has no attribute '_default_month'
@jreback jreback added this to the 0.15.0 milestone Jul 9, 2014
@sinhrks
Copy link
Member

sinhrks commented Jul 9, 2014

In the fix, DateOffset, MonthOffset and YearOffset should be added to pd.offsets.__all__ because test_offsets.py 's exhaustive tests target offsets included in it.

@jreback jreback modified the milestones: 0.15.1, 0.15.0 Sep 10, 2014
@jreback jreback modified the milestones: 0.16.0, Next Major Release Mar 6, 2015
@jbrockmendel
Copy link
Member

My understanding is that MonthOffset, YearOffset, SemiMonthOffset are base classes not indeed to be directly used. Possibly should be privatized?

@jorisvandenbossche
Copy link
Member Author

My understanding is that MonthOffset, YearOffset, SemiMonthOffset are base classes not indeed to be directly used. Possibly should be privatized?

I am not familiar with offsets, but if that is the case: yes, then we should privatize them.

@jbrockmendel
Copy link
Member

These should also be removed from the doc offset_frequency.rst file right?

jbrockmendel added a commit to jbrockmendel/pandas that referenced this issue May 19, 2020
@mroeschke
Copy link
Member

Looks like this has been effectively privatized.

In [2]: pd.offsets.YearOffset()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-6487f32a8b3a> in <module>
----> 1 pd.offsets.YearOffset()

AttributeError: module 'pandas.tseries.offsets' has no attribute 'YearOffset'

And I don't see it in offset_frequency. Closing

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

No branches or pull requests

5 participants