@@ -1610,12 +1610,12 @@ def _nanpercentile1D(values, mask, q, **kw):
1610
1610
1611
1611
if len (values ) == 0 :
1612
1612
if lib .is_scalar (q ):
1613
- return self ._na_value
1613
+ return self .fill_value
1614
1614
else :
1615
- return np .array ([self ._na_value ] * len (q ),
1615
+ return np .array ([self .fill_value ] * len (q ),
1616
1616
dtype = values .dtype )
1617
1617
1618
- return np .percentile (values , q , ** kw )
1618
+ return com .percentile (values , q , ** kw )
1619
1619
1620
1620
def _nanpercentile (values , q , axis , ** kw ):
1621
1621
@@ -1635,7 +1635,7 @@ def _nanpercentile(values, q, axis, **kw):
1635
1635
result = np .array (result , dtype = values .dtype , copy = False ).T
1636
1636
return result
1637
1637
else :
1638
- return np .percentile (values , q , axis = axis , ** kw )
1638
+ return com .percentile (values , q , axis = axis , ** kw )
1639
1639
1640
1640
from pandas import Float64Index
1641
1641
is_empty = values .shape [axis ] == 0
@@ -2134,7 +2134,7 @@ def _na_value(self):
2134
2134
2135
2135
@property
2136
2136
def fill_value (self ):
2137
- return tslibs .iNaT
2137
+ return tslibs .NaT . asm8
2138
2138
2139
2139
def get_values (self , dtype = None ):
2140
2140
"""
@@ -2198,25 +2198,21 @@ def _try_coerce_args(self, values, other):
2198
2198
"""
2199
2199
2200
2200
values_mask = isna (values )
2201
- values = values .view ('i8' )
2202
2201
other_mask = False
2203
2202
2204
- if isinstance (other , bool ):
2205
- raise TypeError
2206
- elif is_null_datelike_scalar (other ):
2207
- other = tslibs .iNaT
2203
+ if is_null_datelike_scalar (other ):
2204
+ other = tslibs .NaT .asm8
2208
2205
other_mask = True
2209
2206
elif isinstance (other , Timedelta ):
2210
2207
other_mask = isna (other )
2211
- other = other .value
2208
+ other = other .asm8
2212
2209
elif isinstance (other , timedelta ):
2213
- other = Timedelta (other ).value
2214
- elif isinstance (other , np .timedelta64 ):
2215
- other_mask = isna (other )
2216
- other = Timedelta (other ).value
2210
+ other = np .timedelta64 (other )
2211
+ elif isinstance (other , (np .timedelta64 , np .ndarray )):
2212
+ pass
2217
2213
elif hasattr (other , 'dtype' ) and is_timedelta64_dtype (other ):
2218
2214
other_mask = isna (other )
2219
- other = other . astype ( 'i8' , copy = False ). view ( 'i8' )
2215
+ other = getattr ( other , 'values' , other )
2220
2216
else :
2221
2217
# coercion issues
2222
2218
# let higher levels handle
@@ -2698,24 +2694,25 @@ def _try_coerce_args(self, values, other):
2698
2694
"""
2699
2695
2700
2696
values_mask = isna (values )
2701
- values = values .view ('i8' )
2702
2697
other_mask = False
2703
2698
2704
- if isinstance (other , bool ):
2705
- raise TypeError
2706
- elif is_null_datelike_scalar (other ):
2707
- other = tslibs .iNaT
2699
+ if getattr (other , 'tz' , None ) is not None :
2700
+ raise TypeError ("cannot coerce a Timestamp with a tz on a "
2701
+ "naive Block" )
2702
+
2703
+ if is_null_datelike_scalar (other ):
2704
+ other = tslibs .NaT .asm8
2708
2705
other_mask = True
2709
- elif isinstance (other , (datetime , np .datetime64 , date )):
2710
- other = self ._box_func (other )
2711
- if getattr (other , 'tz' ) is not None :
2712
- raise TypeError ("cannot coerce a Timestamp with a tz on a "
2713
- "naive Block" )
2706
+ elif isinstance (other , tslibs .Timestamp ):
2714
2707
other_mask = isna (other )
2715
- other = other .asm8 .view ('i8' )
2708
+ other = other .asm8
2709
+ elif isinstance (other , date ):
2710
+ other = np .datetime64 (other )
2711
+ elif isinstance (other , (np .datetime64 , np .ndarray )):
2712
+ pass
2716
2713
elif hasattr (other , 'dtype' ) and is_datetime64_dtype (other ):
2717
2714
other_mask = isna (other )
2718
- other = other . astype ( 'i8' , copy = False ). view ( 'i8' )
2715
+ other = getattr ( other , 'values' , other )
2719
2716
else :
2720
2717
# coercion issues
2721
2718
# let higher levels handle
0 commit comments