Skip to content

Commit 9179e63

Browse files
jorisvandenbosscheTomAugspurger
authored andcommitted
CLN: remove values attribute from datetimelike EAs (pandas-dev#23603)
1 parent efd1844 commit 9179e63

File tree

5 files changed

+6
-13
lines changed

5 files changed

+6
-13
lines changed

pandas/core/arrays/datetimelike.py

+2-7
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def cmp_method(self, other):
6666
with warnings.catch_warnings(record=True):
6767
warnings.filterwarnings("ignore", "elementwise", FutureWarning)
6868
with np.errstate(all='ignore'):
69-
result = op(self.values, np.asarray(other))
69+
result = op(self._data, np.asarray(other))
7070

7171
return result
7272

@@ -119,15 +119,10 @@ def _box_values(self, values):
119119
def __iter__(self):
120120
return (self._box_func(v) for v in self.asi8)
121121

122-
@property
123-
def values(self):
124-
""" return the underlying data as an ndarray """
125-
return self._data.view(np.ndarray)
126-
127122
@property
128123
def asi8(self):
129124
# do not cache or you'll create a memory leak
130-
return self.values.view('i8')
125+
return self._data.view('i8')
131126

132127
# ------------------------------------------------------------------
133128
# Array-like Methods

pandas/core/arrays/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -886,7 +886,7 @@ def to_period(self, freq=None):
886886

887887
freq = get_period_alias(freq)
888888

889-
return PeriodArray._from_datetime64(self.values, freq, tz=self.tz)
889+
return PeriodArray._from_datetime64(self._data, freq, tz=self.tz)
890890

891891
def to_perioddelta(self, freq):
892892
"""

pandas/core/arrays/timedeltas.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def wrapper(self, other):
8181
raise TypeError(msg.format(cls=type(self).__name__,
8282
typ=type(other).__name__))
8383
else:
84-
other = type(self)(other).values
84+
other = type(self)(other)._data
8585
result = meth(self, other)
8686
result = com.values_from_object(result)
8787

pandas/core/indexes/datetimes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def __new__(cls, data=None,
292292
'set specified tz: {1}')
293293
raise TypeError(msg.format(data.tz, tz))
294294

295-
subarr = data.values
295+
subarr = data._data
296296

297297
if freq is None:
298298
freq = data.freq

pandas/tests/extension/test_period.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,7 @@ def test_combine_add(self, data_repeated):
7575

7676
class TestInterface(BasePeriodTests, base.BaseInterfaceTests):
7777

78-
def test_no_values_attribute(self, data):
79-
# We have a values attribute.
80-
pass
78+
pass
8179

8280

8381
class TestArithmeticOps(BasePeriodTests, base.BaseArithmeticOpsTests):

0 commit comments

Comments
 (0)