22import  numpy  as  np 
33import  pytest 
44
5- import  pandas ._libs .tslib  as  tslib 
6- 
75import  pandas  as  pd 
8- from  pandas  import  DatetimeIndex , Index , Period , PeriodIndex , Series 
6+ from  pandas  import  DatetimeIndex , Index , NaT ,  Period , PeriodIndex , Series 
97from  pandas .core .arrays  import  PeriodArray 
108from  pandas .tests .test_base  import  Ops 
119import  pandas .util .testing  as  tm 
@@ -29,13 +27,13 @@ def test_ops_properties(self):
2927    def  test_minmax (self ):
3028
3129        # monotonic 
32-         idx1  =  pd .PeriodIndex ([pd . NaT , '2011-01-01' , '2011-01-02' ,
30+         idx1  =  pd .PeriodIndex ([NaT , '2011-01-01' , '2011-01-02' ,
3331                               '2011-01-03' ], freq = 'D' )
3432        assert  idx1 .is_monotonic 
3533
3634        # non-monotonic 
37-         idx2  =  pd .PeriodIndex (['2011-01-01' , pd . NaT , '2011-01-03' ,
38-                                '2011-01-02' , pd . NaT ], freq = 'D' )
35+         idx2  =  pd .PeriodIndex (['2011-01-01' , NaT , '2011-01-03' ,
36+                                '2011-01-02' , NaT ], freq = 'D' )
3937        assert  not  idx2 .is_monotonic 
4038
4139        for  idx  in  [idx1 , idx2 ]:
@@ -50,15 +48,15 @@ def test_minmax(self):
5048            # Return NaT 
5149            obj  =  PeriodIndex ([], freq = 'M' )
5250            result  =  getattr (obj , op )()
53-             assert  result  is  tslib . NaT 
51+             assert  result  is  NaT 
5452
55-             obj  =  PeriodIndex ([pd . NaT ], freq = 'M' )
53+             obj  =  PeriodIndex ([NaT ], freq = 'M' )
5654            result  =  getattr (obj , op )()
57-             assert  result  is  tslib . NaT 
55+             assert  result  is  NaT 
5856
59-             obj  =  PeriodIndex ([pd . NaT , pd . NaT , pd . NaT ], freq = 'M' )
57+             obj  =  PeriodIndex ([NaT , NaT , NaT ], freq = 'M' )
6058            result  =  getattr (obj , op )()
61-             assert  result  is  tslib . NaT 
59+             assert  result  is  NaT 
6260
6361    def  test_numpy_minmax (self ):
6462        pr  =  pd .period_range (start = '2016-01-15' , end = '2016-01-20' )
@@ -113,7 +111,7 @@ def test_value_counts_unique(self):
113111
114112        idx  =  PeriodIndex (['2013-01-01 09:00' , '2013-01-01 09:00' ,
115113                           '2013-01-01 09:00' , '2013-01-01 08:00' ,
116-                            '2013-01-01 08:00' , pd . NaT ], freq = 'H' )
114+                            '2013-01-01 08:00' , NaT ], freq = 'H' )
117115
118116        exp_idx  =  PeriodIndex (['2013-01-01 09:00' , '2013-01-01 08:00' ],
119117                              freq = 'H' )
@@ -123,7 +121,7 @@ def test_value_counts_unique(self):
123121            tm .assert_series_equal (obj .value_counts (), expected )
124122
125123        exp_idx  =  PeriodIndex (['2013-01-01 09:00' , '2013-01-01 08:00' ,
126-                                pd . NaT ], freq = 'H' )
124+                                NaT ], freq = 'H' )
127125        expected  =  Series ([3 , 2 , 1 ], index = exp_idx )
128126
129127        for  obj  in  [idx , Series (idx )]:
@@ -284,9 +282,9 @@ def test_order(self):
284282                            '2011-01-03' , '2011-01-05' ],
285283                           freq = 'D' , name = 'idx2' )
286284
287-         idx3  =  PeriodIndex ([pd . NaT , '2011-01-03' , '2011-01-05' ,
288-                             '2011-01-02' , pd . NaT ], freq = 'D' , name = 'idx3' )
289-         exp3  =  PeriodIndex ([pd . NaT , pd . NaT , '2011-01-02' , '2011-01-03' ,
285+         idx3  =  PeriodIndex ([NaT , '2011-01-03' , '2011-01-05' ,
286+                             '2011-01-02' , NaT ], freq = 'D' , name = 'idx3' )
287+         exp3  =  PeriodIndex ([NaT , NaT , '2011-01-02' , '2011-01-03' ,
290288                            '2011-01-05' ], freq = 'D' , name = 'idx3' )
291289
292290        for  idx , expected  in  [(idx1 , exp1 ), (idx2 , exp2 ), (idx3 , exp3 )]:
@@ -338,8 +336,8 @@ def test_repeat(self):
338336            tm .assert_index_equal (res , exp )
339337
340338    def  test_nat (self ):
341-         assert  pd .PeriodIndex ._na_value  is  pd . NaT 
342-         assert  pd .PeriodIndex ([], freq = 'M' )._na_value  is  pd . NaT 
339+         assert  pd .PeriodIndex ._na_value  is  NaT 
340+         assert  pd .PeriodIndex ([], freq = 'M' )._na_value  is  NaT 
343341
344342        idx  =  pd .PeriodIndex (['2011-01-01' , '2011-01-02' ], freq = 'D' )
345343        assert  idx ._can_hold_na 
@@ -460,10 +458,10 @@ def test_pi_comp_period_nat(self):
460458        f  =  lambda  x : pd .Period ('2011-03' , freq = 'M' ) ==  x 
461459        self ._check (idx , f , exp )
462460
463-         f  =  lambda  x : x  ==  tslib . NaT 
461+         f  =  lambda  x : x  ==  NaT 
464462        exp  =  np .array ([False , False , False , False ], dtype = np .bool )
465463        self ._check (idx , f , exp )
466-         f  =  lambda  x : tslib . NaT  ==  x 
464+         f  =  lambda  x : NaT  ==  x 
467465        self ._check (idx , f , exp )
468466
469467        f  =  lambda  x : x  !=  pd .Period ('2011-03' , freq = 'M' )
@@ -472,10 +470,10 @@ def test_pi_comp_period_nat(self):
472470        f  =  lambda  x : pd .Period ('2011-03' , freq = 'M' ) !=  x 
473471        self ._check (idx , f , exp )
474472
475-         f  =  lambda  x : x  !=  tslib . NaT 
473+         f  =  lambda  x : x  !=  NaT 
476474        exp  =  np .array ([True , True , True , True ], dtype = np .bool )
477475        self ._check (idx , f , exp )
478-         f  =  lambda  x : tslib . NaT  !=  x 
476+         f  =  lambda  x : NaT  !=  x 
479477        self ._check (idx , f , exp )
480478
481479        f  =  lambda  x : pd .Period ('2011-03' , freq = 'M' ) >=  x 
@@ -486,11 +484,11 @@ def test_pi_comp_period_nat(self):
486484        exp  =  np .array ([True , False , False , False ], dtype = np .bool )
487485        self ._check (idx , f , exp )
488486
489-         f  =  lambda  x : x  >  tslib . NaT 
487+         f  =  lambda  x : x  >  NaT 
490488        exp  =  np .array ([False , False , False , False ], dtype = np .bool )
491489        self ._check (idx , f , exp )
492490
493-         f  =  lambda  x : tslib . NaT  >=  x 
491+         f  =  lambda  x : NaT  >=  x 
494492        exp  =  np .array ([False , False , False , False ], dtype = np .bool )
495493        self ._check (idx , f , exp )
496494
0 commit comments