-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
diff reduction for 24024 #24543
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
diff reduction for 24024 #24543
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
from pandas.core import common as com | ||
from pandas.core.accessor import delegate_names | ||
from pandas.core.algorithms import unique1d | ||
from pandas.core.arrays.datetimelike import DatelikeOps | ||
from pandas.core.arrays.period import ( | ||
PeriodArray, period_array, validate_dtype_freq) | ||
from pandas.core.base import _shared_docs | ||
|
@@ -70,9 +69,9 @@ class PeriodDelegateMixin(DatetimelikeDelegateMixin): | |
typ='property') | ||
@delegate_names(PeriodArray, | ||
PeriodDelegateMixin._delegated_methods, | ||
typ="method") | ||
class PeriodIndex(DatelikeOps, DatetimeIndexOpsMixin, Int64Index, | ||
PeriodDelegateMixin): | ||
typ="method", | ||
overwrite=True) | ||
class PeriodIndex(DatetimeIndexOpsMixin, Int64Index, PeriodDelegateMixin): | ||
""" | ||
Immutable ndarray holding ordinal values indicating regular periods in | ||
time such as particular years, quarters, months, etc. | ||
|
@@ -291,20 +290,15 @@ def _eadata(self): | |
def values(self): | ||
return np.asarray(self) | ||
|
||
@property | ||
def _values(self): | ||
return self._data | ||
|
||
@property | ||
def freq(self): | ||
# TODO(DatetimeArray): remove | ||
# Can't simply use delegate_names since our base class is defining | ||
# freq | ||
return self._data.freq | ||
|
||
@freq.setter | ||
def freq(self, value): | ||
value = Period._maybe_convert_freq(value) | ||
# Note: When this deprecation is enforced, PeriodIndex.freq can | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. make this TODO |
||
# be removed entirely, and we'll just inherit. | ||
msg = ('Setting {cls}.freq has been deprecated and will be ' | ||
'removed in a future version; use {cls}.asfreq instead. ' | ||
'The {cls}.freq setter is not guaranteed to work.') | ||
|
@@ -897,11 +891,6 @@ def flags(self): | |
FutureWarning, stacklevel=2) | ||
return self._ndarray_values.flags | ||
|
||
@property | ||
def asi8(self): | ||
# TODO(DatetimeArray): remove | ||
return self.view('i8') | ||
|
||
def item(self): | ||
""" | ||
return the first element of the underlying data as a python | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3245,7 +3245,8 @@ def test_setitem(self): | |
b1 = df._data.blocks[1] | ||
b2 = df._data.blocks[2] | ||
assert b1.values.equals(b2.values) | ||
assert id(b1.values.values.base) != id(b2.values.values.base) | ||
if b1.values.values.base is not None: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add a comment here on what you are checking There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should be covered by the comment 2 lines up |
||
assert id(b1.values.values.base) != id(b2.values.values.base) | ||
|
||
# with nan | ||
df2 = df.copy() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer the original way of calling this, e.g.
self._from_sequence(res_values, freq='infer')