@@ -861,26 +861,21 @@ def test_nat(self):
861
861
self .assertIs (pd .DatetimeIndex ([])._na_value , pd .NaT )
862
862
863
863
for tz in [None , 'US/Eastern' , 'UTC' ]:
864
-
865
864
idx = pd .DatetimeIndex (['2011-01-01' , '2011-01-02' ], tz = tz )
866
865
self .assertTrue (idx ._can_hold_na )
867
866
868
867
tm .assert_numpy_array_equal (idx ._isnan , np .array ([False , False ]))
869
868
self .assertFalse (idx .hasnans )
870
-
871
- tm . assert_numpy_array_equal ( idx . _nan_idxs , np .array ([], dtype = np .intp ))
869
+ tm . assert_numpy_array_equal ( idx . _nan_idxs ,
870
+ np .array ([], dtype = np .intp ))
872
871
873
872
idx = pd .DatetimeIndex (['2011-01-01' , 'NaT' ], tz = tz )
874
873
self .assertTrue (idx ._can_hold_na )
875
874
876
-
877
- self .assertTrue (idx .hasnans )
878
-
879
875
tm .assert_numpy_array_equal (idx ._isnan , np .array ([False , True ]))
880
-
881
-
882
- tm .assert_numpy_array_equal (idx ._nan_idxs , np .array ([1 ], dtype = np .intp ))
883
-
876
+ self .assertTrue (idx .hasnans )
877
+ tm .assert_numpy_array_equal (idx ._nan_idxs ,
878
+ np .array ([1 ], dtype = np .intp ))
884
879
885
880
def test_equals (self ):
886
881
# GH 13107
@@ -1712,25 +1707,25 @@ def test_repeat(self):
1712
1707
tm .assert_index_equal (res , exp )
1713
1708
self .assertIsNone (res .freq )
1714
1709
1715
- # def test_nat(self):
1716
- # self.assertIs(pd.TimedeltaIndex._na_value, pd.NaT)
1717
- # self.assertIs(pd.TimedeltaIndex([])._na_value, pd.NaT)
1718
- #
1719
- # idx = pd.TimedeltaIndex(['1 days', '2 days'])
1720
- # self.assertTrue(idx._can_hold_na)
1721
- #
1722
- # tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
1723
- # self.assertFalse(idx.hasnans)
1724
- # tm.assert_numpy_array_equal(idx._nan_idxs,
1725
- # np.array([], dtype=np.int64 ))
1726
- #
1727
- # idx = pd.TimedeltaIndex(['1 days', 'NaT'])
1728
- # self.assertTrue(idx._can_hold_na)
1729
- #
1730
- # tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))
1731
- # self.assertTrue(idx.hasnans)
1732
- # tm.assert_numpy_array_equal(idx._nan_idxs,
1733
- # np.array([1], dtype=np.int64 ))
1710
+ def test_nat (self ):
1711
+ self .assertIs (pd .TimedeltaIndex ._na_value , pd .NaT )
1712
+ self .assertIs (pd .TimedeltaIndex ([])._na_value , pd .NaT )
1713
+
1714
+ idx = pd .TimedeltaIndex (['1 days' , '2 days' ])
1715
+ self .assertTrue (idx ._can_hold_na )
1716
+
1717
+ tm .assert_numpy_array_equal (idx ._isnan , np .array ([False , False ]))
1718
+ self .assertFalse (idx .hasnans )
1719
+ tm .assert_numpy_array_equal (idx ._nan_idxs ,
1720
+ np .array ([], dtype = np .intp ))
1721
+
1722
+ idx = pd .TimedeltaIndex (['1 days' , 'NaT' ])
1723
+ self .assertTrue (idx ._can_hold_na )
1724
+
1725
+ tm .assert_numpy_array_equal (idx ._isnan , np .array ([False , True ]))
1726
+ self .assertTrue (idx .hasnans )
1727
+ tm .assert_numpy_array_equal (idx ._nan_idxs ,
1728
+ np .array ([1 ], dtype = np .intp ))
1734
1729
1735
1730
def test_equals (self ):
1736
1731
# GH 13107
@@ -2709,25 +2704,25 @@ def test_repeat(self):
2709
2704
for res in [index .repeat (3 ), np .repeat (index , 3 )]:
2710
2705
tm .assert_index_equal (res , exp )
2711
2706
2712
- # def test_nat(self):
2713
- # self.assertIs(pd.PeriodIndex._na_value, pd.NaT)
2714
- # self.assertIs(pd.PeriodIndex([], freq='M')._na_value, pd.NaT)
2715
- #
2716
- # idx = pd.PeriodIndex(['2011-01-01', '2011-01-02'], freq='D')
2717
- # self.assertTrue(idx._can_hold_na)
2718
- #
2719
- # tm.assert_numpy_array_equal(idx._isnan, np.array([False, False]))
2720
- # self.assertFalse(idx.hasnans)
2721
- # tm.assert_numpy_array_equal(idx._nan_idxs,
2722
- # np.array([], dtype=np.int64 ))
2723
- #
2724
- # idx = pd.PeriodIndex(['2011-01-01', 'NaT'], freq='D')
2725
- # self.assertTrue(idx._can_hold_na)
2726
- #
2727
- # tm.assert_numpy_array_equal(idx._isnan, np.array([False, True]))
2728
- # self.assertTrue(idx.hasnans)
2729
- # tm.assert_numpy_array_equal(idx._nan_idxs,
2730
- # np.array([1], dtype=np.int64 ))
2707
+ def test_nat (self ):
2708
+ self .assertIs (pd .PeriodIndex ._na_value , pd .NaT )
2709
+ self .assertIs (pd .PeriodIndex ([], freq = 'M' )._na_value , pd .NaT )
2710
+
2711
+ idx = pd .PeriodIndex (['2011-01-01' , '2011-01-02' ], freq = 'D' )
2712
+ self .assertTrue (idx ._can_hold_na )
2713
+
2714
+ tm .assert_numpy_array_equal (idx ._isnan , np .array ([False , False ]))
2715
+ self .assertFalse (idx .hasnans )
2716
+ tm .assert_numpy_array_equal (idx ._nan_idxs ,
2717
+ np .array ([], dtype = np .intp ))
2718
+
2719
+ idx = pd .PeriodIndex (['2011-01-01' , 'NaT' ], freq = 'D' )
2720
+ self .assertTrue (idx ._can_hold_na )
2721
+
2722
+ tm .assert_numpy_array_equal (idx ._isnan , np .array ([False , True ]))
2723
+ self .assertTrue (idx .hasnans )
2724
+ tm .assert_numpy_array_equal (idx ._nan_idxs ,
2725
+ np .array ([1 ], dtype = np .intp ))
2731
2726
2732
2727
def test_equals (self ):
2733
2728
# GH 13107
0 commit comments