5
5
import numpy as np
6
6
import warnings
7
7
8
- from pandas ._libs import tslib , lib
9
- from pandas ._libs .tslib import iNaT
8
+ from pandas ._libs import tslib , lib , tslibs
9
+ from pandas ._libs .tslibs import iNaT
10
10
from pandas .compat import string_types , text_type , PY3
11
11
from .common import (_ensure_object , is_bool , is_integer , is_float ,
12
12
is_complex , is_datetimetz , is_categorical_dtype ,
@@ -278,14 +278,14 @@ def maybe_promote(dtype, fill_value=np.nan):
278
278
else :
279
279
if issubclass (dtype .type , np .datetime64 ):
280
280
try :
281
- fill_value = tslib .Timestamp (fill_value ).value
281
+ fill_value = tslibs .Timestamp (fill_value ).value
282
282
except Exception :
283
283
# the proper thing to do here would probably be to upcast
284
284
# to object (but numpy 1.6.1 doesn't do this properly)
285
285
fill_value = iNaT
286
286
elif issubclass (dtype .type , np .timedelta64 ):
287
287
try :
288
- fill_value = tslib .Timedelta (fill_value ).value
288
+ fill_value = tslibs .Timedelta (fill_value ).value
289
289
except Exception :
290
290
# as for datetimes, cannot upcast to object
291
291
fill_value = iNaT
@@ -393,8 +393,8 @@ def infer_dtype_from_scalar(val, pandas_dtype=False):
393
393
dtype = np .object_
394
394
395
395
elif isinstance (val , (np .datetime64 , datetime )):
396
- val = tslib .Timestamp (val )
397
- if val is tslib .NaT or val .tz is None :
396
+ val = tslibs .Timestamp (val )
397
+ if val is tslibs .NaT or val .tz is None :
398
398
dtype = np .dtype ('M8[ns]' )
399
399
else :
400
400
if pandas_dtype :
@@ -405,7 +405,7 @@ def infer_dtype_from_scalar(val, pandas_dtype=False):
405
405
val = val .value
406
406
407
407
elif isinstance (val , (np .timedelta64 , timedelta )):
408
- val = tslib .Timedelta (val ).value
408
+ val = tslibs .Timedelta (val ).value
409
409
dtype = np .dtype ('m8[ns]' )
410
410
411
411
elif is_bool (val ):
@@ -625,7 +625,7 @@ def conv(r, dtype):
625
625
if isna (r ):
626
626
pass
627
627
elif dtype == _NS_DTYPE :
628
- r = tslib .Timestamp (r )
628
+ r = tslibs .Timestamp (r )
629
629
elif dtype == _TD_DTYPE :
630
630
r = _coerce_scalar_to_timedelta_type (r )
631
631
elif dtype == np .bool_ :
@@ -679,7 +679,7 @@ def astype_nansafe(arr, dtype, copy=True):
679
679
680
680
elif is_timedelta64_dtype (arr ):
681
681
if is_object_dtype (dtype ):
682
- return tslib .ints_to_pytimedelta (arr .view (np .int64 ))
682
+ return tslibs .ints_to_pytimedelta (arr .view (np .int64 ))
683
683
elif dtype == np .int64 :
684
684
return arr .view (dtype )
685
685
0 commit comments