Skip to content

BUG: Timestamp subtraction of NaT with timezones #12241

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

Closed
wants to merge 1 commit into from

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented Feb 6, 2016

Closes #11718.

  • Ops with NaT and Timestamp with tz results in NaT
  • Ops with NaT and DatetimeIndex / TimedeltaIndex results in corresponding Index filled with NaT.

@sinhrks sinhrks added Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Timezones Timezone data dtype labels Feb 6, 2016
@sinhrks sinhrks added this to the 0.18.0 milestone Feb 6, 2016
result = self._maybe_mask_results(result, fill_value=tslib.iNaT)
if other is tslib.NaT:
result = np.zeros(len(self), dtype=np.int64)
result.fill(tslib.iNaT)
Copy link
Contributor

Choose a reason for hiding this comment

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

these 2 lines should be a private function in tseries/base.py somewhere.

@sinhrks sinhrks force-pushed the nat_ops branch 4 times, most recently from bb06973 to 06cab78 Compare February 11, 2016 02:52

from pandas.tseries.period import PeriodIndex
attribs = self._get_attributes_dict()
if not isinstance(self, PeriodIndex):
Copy link
Contributor

Choose a reason for hiding this comment

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

you can use ABCPeriodIndex

@jreback
Copy link
Contributor

jreback commented Feb 11, 2016

@sinhrks one small comment. looks much cleaner. thanks. merge when green (or ping and I can).

@sinhrks
Copy link
Member Author

sinhrks commented Feb 11, 2016

Thanks, fixed to use ABCPeriodIndex. Will merge when green.

@jreback
Copy link
Contributor

jreback commented Feb 11, 2016

lgtm!

@sinhrks sinhrks closed this in d838db7 Feb 11, 2016
@sinhrks sinhrks deleted the nat_ops branch February 11, 2016 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Missing-data np.nan, pd.NaT, pd.NA, dropna, isnull, interpolate Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants