10000 [REF] Move comparison methods to EAMixins, share code by jbrockmendel · Pull Request #21872 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

[REF] Move comparison methods to EAMixins, share code #21872

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 17 commits into from
Jul 14, 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
Next Next commit
make imports absolute
  • Loading branch information
jbrockmendel committed Jul 12, 2018
commit 1044d23c3d475c452293464fa31981dc27b68c7e
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
from pandas.tseries.frequencies import to_offset, DateOffset
from pandas.tseries.offsets import Tick

from .datetimelike import DatetimeLikeArrayMixin
from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin


def _to_m8(key, tz=None):
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pandas.tseries import frequencies
from pandas.tseries.offsets import Tick, DateOffset

from .datetimelike import DatetimeLikeArrayMixin
from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin


def _field_accessor(name, alias, docstring=None):
Expand Down
7 changes: 3 additions & 4 deletions pandas/core/arrays/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
from pandas.tseries.offsets import Tick, DateOffset
from pandas.tseries.frequencies import to_offset

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you change to absolute imports, I think we are moving away from the relative ones fro readability.

from .datetimelike import DatetimeLikeArrayMixin
from . import datetimelike as dtl
import pandas.core.arrays.datetimelike as dtl


def _to_m8(key):
Expand Down Expand Up @@ -63,7 +62,7 @@ def _td_array_cmp(opname, cls):

def wrapper(self, other):
msg = "cannot compare a {cls} with type {typ}"
meth = getattr(DatetimeLikeArrayMixin, opname)
meth = getattr(dtl.DatetimeLikeArrayMixin, opname)
if _is_convertible_to_td(other) or other is NaT:
try:
other = _to_m8(other)
Expand Down Expand Up @@ -95,7 +94,7 @@ def wrapper(self, other):
return compat.set_function_name(wrapper, opname, cls)


class TimedeltaArrayMixin(DatetimeLikeArrayMixin):
class TimedeltaArrayMixin(dtl.DatetimeLikeArrayMixin):
@property
def _box_func(self):
return lambda x: Timedelta(x, unit='ns')
Expand Down
0