8000 TST: Test cleanup, parametrization for datetime64 arithmetic tests by jbrockmendel · Pull Request #23681 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TST: Test cleanup, parametrization for datetime64 arithmetic tests #23681

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 13 commits into from
Nov 16, 2018
Merged
Prev Previous commit
Next Next commit
fix location of tz check
  • Loading branch information
jbrockmendel committed Nov 15, 2018
commit 89fe6d99b471f93a0f40053326e4129e5d511ae3
6 changes: 3 additions & 3 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,6 @@ def _simple_new(cls, values, freq=None, tz=None, **kwargs):
return result

def __new__(cls, values, freq=None, tz=None, dtype=None):
if tz is None and hasattr(values, 'tz'):
# e.g. DatetimeIndex
tz = values.tz

if freq is None and hasattr(values, "freq"):
# i.e. DatetimeArray, DatetimeIndex
Expand All @@ -228,7 +225,10 @@ def __new__(cls, values, freq=None, tz=None, dtype=None):

if isinstance(values, DatetimeArrayMixin):
# extract nanosecond unix timestamps
if tz is None:
tz = values.tz
values = values.asi8

if values.dtype == 'i8':
values = values.view('M8[ns]')

Expand Down
0