@@ -1943,19 +1943,6 @@ def test_split(self):
1943
1943
[u ('f' ), u ('g' ), u ('h' )]])
1944
1944
tm .assert_series_equal (result , exp )
1945
1945
1946
- # expand blank split GH 20067
1947
- values = Series (['' ])
1948
- result = values .str .split (expand = True )
1949
- exp = DataFrame ([[]])
1950
- tm .assert_frame_equal (result , exp )
1951
-
1952
- values = Series (['a b c' , 'a b' , '' , ' ' ])
1953
- result = values .str .split (expand = True )
1954
- exp = DataFrame ([['a' , 'b' , 'c' ], ['a' , 'b' , np .nan ],
1955
- [np .nan , np .nan , np .nan ], [np .nan , np .nan , np .nan ]])
1956
- tm .assert_frame_equal (result , exp )
1957
-
1958
-
1959
1946
def test_rsplit (self ):
1960
1947
values = Series (['a_b_c' , 'c_d_e' , NA , 'f_g_h' ])
1961
1948
result = values .str .rsplit ('_' )
@@ -2005,6 +1992,19 @@ def test_rsplit(self):
2005
1992
exp = Series ([['a_b' , 'c' ], ['c_d' , 'e' ], NA , ['f_g' , 'h' ]])
2006
1993
tm .assert_series_equal (result , exp )
2007
1994
1995
+ def test_split_blank_string (self ):
1996
+ # expand blank split GH 20067
1997
+ values = Series (['' ])
1998
+ result = values .str .split (expand = True )
1999
+ exp = DataFrame ([[]])
2000
+ tm .assert_frame_equal (result , exp )
2001
+
2002
+ values = Series (['a b c' , 'a b' , '' , ' ' ])
2003
+ result = values .str .split (expand = True )
2004
+ exp = DataFrame ([['a' , 'b' , 'c' ], ['a' , 'b' , np .nan ],
2005
+ [np .nan , np .nan , np .nan ], [np .nan , np .nan , np .nan ]])
2006
+ tm .assert_frame_equal (result , exp )
2007
+
2008
2008
def test_split_noargs (self ):
2009
2009
# #1859
2010
2010
s = Series (['Wes McKinney' , 'Travis Oliphant' ])
0 commit comments