Skip to content
Merged
Changes from all commits
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
16 changes: 15 additions & 1 deletion pandas/core/internals.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from pandas.tslib import Timestamp
from pandas import compat
from pandas.compat import range, lrange, lmap, callable, map, zip

from pandas.tseries.timedeltas import _coerce_scalar_to_timedelta_type

class Block(PandasObject):

Expand Down Expand Up @@ -1083,6 +1083,20 @@ def _try_fill(self, value):

return value

def _try_coerce_args(self, values, other):
""" provide coercion to our input arguments
we are going to compare vs i8, so coerce to integer
values is always ndarra like, other may not be """
values = values.view('i8')
if isnull(other) or (np.isscalar(other) and other == tslib.iNaT):
other = tslib.iNaT
elif isinstance(other, np.timedelta64):
other = _coerce_scalar_to_timedelta_type(other,unit='s').item()
else:
other = other.view('i8')

return values, other

def _try_operate(self, values):
""" return a version to operate on """
return values.view('i8')
Expand Down