8000 Implement reductions from #24024 by jbrockmendel · Pull Request #24484 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Implement reductions from #24024 #24484

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

Merged
merged 6 commits into from
Dec 29, 2018
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
Prev Previous commit
Merge branch 'master' of https://github.com/pandas-dev/pandas into eared
  • Loading branch information
jbrockmendel committed Dec 29, 2018
commit bf9960748aef4ccb984b7e988a8f093f4fd4c403
5 changes: 0 additions & 5 deletions pandas/core/indexes/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,11 +1145,6 @@ def _eadata(self):
_is_monotonic_decreasing = Index.is_monotonic_decreasing
_is_unique = Index.is_unique

# Override DatetimeArray methods
max = DatetimeIndexOpsMixin.max
min = DatetimeIndexOpsMixin.min
_reduce = Index._reduce

_timezone = cache_readonly(DatetimeArray._timezone.fget)
is_normalized = cache_readonly(DatetimeArray.is_normalized.fget)
_resolution = cache_readonly(DatetimeArray._resolution.fget)
Expand Down
30 changes: 26 additions & 4 deletions pandas/core/indexes/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,10 +301,32 @@ def _eadata(self):
_is_monotonic_decreasing = Index.is_monotonic_decreasing
_is_unique = Index.is_unique

# Override DatetimeArray methods
max = DatetimeIndexOpsMixin.max
min = DatetimeIndexOpsMixin.min
_reduce = Index._reduce
_create_comparison_method = DatetimeIndexOpsMixin._create_comparison_method
# TODO: make sure we have a test for name retention analogous
# to series.test_arithmetic.test_ser_cmp_result_names;
# also for PeriodIndex which I think may be missing one

@property
def _box_func(self):
return lambda x: Timedelta(x, unit='ns')

def __getitem__(self, key):
result = self._eadata.__getitem__(key)
if is_scalar(result):
return result
return type(self)(result, name=self.name)

@property
def freq(self): # TODO: get via eadata
return self._freq

@freq.setter
def freq(self, value): # TODO: get via eadata
if value is not None:
# dispatch to TimedeltaArray to validate frequency
self._eadata.freq = value

self._freq = to_offset(value)

# -------------------------------------------------------------------

Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.
0