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

CLN: remove values attribute from datetimelike EAs #23603

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def cmp_method(self, other):
with warnings.catch_warnings(record=True):
warnings.filterwarnings("ignore", "elementwise", FutureWarning)
with np.errstate(all='ignore'):
result = op(self.values, np.asarray(other))
result = op(self._data, np.asarray(other))

return result

Expand Down Expand Up @@ -119,15 +119,10 @@ def _box_values(self, values):
def __iter__(self):
return (self._box_func(v) for v in self.asi8)

@property
def values(self):
""" return the underlying data as an ndarray """
return self._data.view(np.ndarray)

@property
def asi8(self):
# do not cache or you'll create a memory leak
return self.values.view('i8')
return self._data.view('i8')

# ------------------------------------------------------------------
# Array-like Methods
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ def to_period(self, freq=None):

freq = get_period_alias(freq)

return PeriodArray._from_datetime64(self.values, freq, tz=self.tz)
return PeriodArray._from_datetime64(self._data, freq, tz=self.tz)

def to_perioddelta(self, freq):
"""
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def wrapper(self, other):
raise TypeError(msg.format(cls=type(self).__name__,
typ=type(other).__name__))
else:
other = type(self)(other).values
other = type(self)(other)._data
result = meth(self, other)
result = com.values_from_object(result)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def __new__(cls, data=None,
'set specified tz: {1}')
raise TypeError(msg.format(data.tz, tz))

subarr = data.values
subarr = data._data

if freq is None:
freq = data.freq
Expand Down