@@ -182,7 +182,7 @@ def _use_inf_as_null(key):
182
182
183
183
def _isnull_ndarraylike (obj ):
184
184
185
- values = obj
185
+ values = getattr ( obj , 'values' , obj )
186
186
dtype = values .dtype
187
187
188
188
if dtype .kind in ('O' , 'S' , 'U' ):
@@ -198,22 +198,15 @@ def _isnull_ndarraylike(obj):
198
198
199
199
elif dtype in _DATELIKE_DTYPES :
200
200
# this is the NaT pattern
201
- v = getattr (values , 'asi8' , None )
202
- if v is None :
203
- v = values .view ('i8' )
204
- result = v == tslib .iNaT
201
+ result = values .view ('i8' ) == tslib .iNaT
205
202
else :
206
- result = np .isnan (obj )
207
-
208
- if isinstance (obj , ABCSeries ):
209
- from pandas import Series
210
- result = Series (result , index = obj .index , copy = False )
203
+ result = np .isnan (values )
211
204
212
205
return result
213
206
214
207
215
208
def _isnull_ndarraylike_old (obj ):
216
- values = obj
209
+ values = getattr ( obj , 'values' , obj )
217
210
dtype = values .dtype
218
211
219
212
if dtype .kind in ('O' , 'S' , 'U' ):
@@ -229,16 +222,9 @@ def _isnull_ndarraylike_old(obj):
229
222
230
223
elif dtype in _DATELIKE_DTYPES :
231
224
# this is the NaT pattern
232
- v = getattr (values , 'asi8' , None )
233
- if v is None :
234
- v = values .view ('i8' )
235
- result = v == tslib .iNaT
225
+ result = values .view ('i8' ) == tslib .iNaT
236
226
else :
237
- result = - np .isfinite (obj )
238
-
239
- if isinstance (obj , ABCSeries ):
240
- from pandas import Series
241
- result = Series (result , index = obj .index , copy = False )
227
+ result = - np .isfinite (values )
242
228
243
229
return result
244
230
0 commit comments