Skip to content

Commit 147de57

Browse files
committed
revert some removals
1 parent 11db555 commit 147de57

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,27 @@ def tz(self, value):
373373
raise AttributeError("Cannot directly set timezone. Use tz_localize() "
374374
"or tz_convert() as appropriate")
375375

376+
@property
377+
def size(self):
378+
# TODO: Remove this when we have a DatetimeTZArray
379+
# Necessary to avoid recursion error since DTI._values is a DTI
380+
# for TZ-aware
381+
return self._ndarray_values.size
382+
383+
@property
384+
def shape(self):
385+
# TODO: Remove this when we have a DatetimeTZArray
386+
# Necessary to avoid recursion error since DTI._values is a DTI
387+
# for TZ-aware
388+
return self._ndarray_values.shape
389+
390+
@property
391+
def nbytes(self):
392+
# TODO: Remove this when we have a DatetimeTZArray
393+
# Necessary to avoid recursion error since DTI._values is a DTI
394+
# for TZ-aware
395+
return self._ndarray_values.nbytes
396+
376397
def _mpl_repr(self):
377398
# how to represent ourselves to matplotlib
378399
return libts.ints_to_pydatetime(self.asi8, self.tz)

pandas/core/indexes/period.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,16 @@ def __array_wrap__(self, result, context=None):
312312
# cannot pass _simple_new as it is
313313
return self._shallow_copy(result, freq=self.freq, name=self.name)
314314

315+
@property
316+
def size(self):
317+
# Avoid materializing self._values
318+
return self._ndarray_values.size
319+
320+
@property
321+
def shape(self):
322+
# Avoid materializing self._values
323+
return self._ndarray_values.shape
324+
315325
@property
316326
def _formatter_func(self):
317327
return lambda x: "'%s'" % x

0 commit comments

Comments
 (0)