@@ -2493,7 +2493,7 @@ def test_partition_series(self):
2493
2493
('f g' , ' ' , 'h' )])
2494
2494
tm .assert_series_equal (result , exp )
2495
2495
2496
- # Not splited
2496
+ # Not split
2497
2497
values = Series (['abc' , 'cde' , NA , 'fgh' ])
2498
2498
result = values .str .partition ('_' , expand = False )
2499
2499
exp = Series ([('abc' , '' , '' ), ('cde' , '' , '' ), NA , ('fgh' , '' , '' )])
@@ -2524,28 +2524,30 @@ def test_partition_series(self):
2524
2524
assert result == [v .rpartition ('_' ) for v in values ]
2525
2525
2526
2526
def test_partition_index (self ):
2527
- values = Index (['a_b_c' , 'c_d_e' , 'f_g_h' ])
2527
+ values = Index (['a_b_c' , 'c_d_e' , 'f_g_h' , np . nan ])
2528
2528
2529
2529
result = values .str .partition ('_' , expand = False )
2530
- exp = Index (np .array ([('a' , '_' , 'b_c' ), ('c' , '_' , 'd_e' ), ( 'f' , '_' ,
2531
- 'g_h' )]))
2530
+ exp = Index (np .array ([('a' , '_' , 'b_c' ), ('c' , '_' , 'd_e' ),
2531
+ ( 'f' , '_' , 'g_h' ), np . nan ]))
2532
2532
tm .assert_index_equal (result , exp )
2533
2533
assert result .nlevels == 1
2534
2534
2535
2535
result = values .str .rpartition ('_' , expand = False )
2536
- exp = Index (np .array ([('a_b' , '_' , 'c' ), ('c_d' , '_' , 'e' ), (
2537
- 'f_g' , '_' , 'h' )]))
2536
+ exp = Index (np .array ([('a_b' , '_' , 'c' ), ('c_d' , '_' , 'e' ),
2537
+ ( 'f_g' , '_' , 'h' ), np . nan ]))
2538
2538
tm .assert_index_equal (result , exp )
2539
2539
assert result .nlevels == 1
2540
2540
2541
2541
result = values .str .partition ('_' )
2542
- exp = Index ([('a' , '_' , 'b_c' ), ('c' , '_' , 'd_e' ), ('f' , '_' , 'g_h' )])
2542
+ exp = Index ([('a' , '_' , 'b_c' ), ('c' , '_' , 'd_e' ),
2543
+ ('f' , '_' , 'g_h' ), (np .nan , np .nan , np .nan )])
2543
2544
tm .assert_index_equal (result , exp )
2544
2545
assert isinstance (result , MultiIndex )
2545
2546
assert result .nlevels == 3
2546
2547
2547
2548
result = values .str .rpartition ('_' )
2548
- exp = Index ([('a_b' , '_' , 'c' ), ('c_d' , '_' , 'e' ), ('f_g' , '_' , 'h' )])
2549
+ exp = Index ([('a_b' , '_' , 'c' ), ('c_d' , '_' , 'e' ),
2550
+ ('f_g' , '_' , 'h' ), (np .nan , np .nan , np .nan )])
2549
2551
tm .assert_index_equal (result , exp )
2550
2552
assert isinstance (result , MultiIndex )
2551
2553
assert result .nlevels == 3
0 commit comments