@@ -1906,45 +1906,6 @@ def test_split_no_pat_with_nonzero_n(self):
1906
1906
1907
1907
def test_split_to_dataframe (self ):
1908
1908
s = Series (['nosplit' , 'alsonosplit' ])
1909
-
1910
- with tm .assert_produces_warning (FutureWarning ):
1911
- result = s .str .split ('_' , return_type = 'frame' )
1912
-
1913
- exp = DataFrame ({0 : Series (['nosplit' , 'alsonosplit' ])})
1914
- tm .assert_frame_equal (result , exp )
1915
-
1916
- s = Series (['some_equal_splits' , 'with_no_nans' ])
1917
- with tm .assert_produces_warning (FutureWarning ):
1918
- result = s .str .split ('_' , return_type = 'frame' )
1919
- exp = DataFrame ({0 : ['some' , 'with' ],
1920
- 1 : ['equal' , 'no' ],
1921
- 2 : ['splits' , 'nans' ]})
1922
- tm .assert_frame_equal (result , exp )
1923
-
1924
- s = Series (['some_unequal_splits' , 'one_of_these_things_is_not' ])
1925
- with tm .assert_produces_warning (FutureWarning ):
1926
- result = s .str .split ('_' , return_type = 'frame' )
1927
- exp = DataFrame ({0 : ['some' , 'one' ],
1928
- 1 : ['unequal' , 'of' ],
1929
- 2 : ['splits' , 'these' ],
1930
- 3 : [NA , 'things' ],
1931
- 4 : [NA , 'is' ],
1932
- 5 : [NA , 'not' ]})
1933
- tm .assert_frame_equal (result , exp )
1934
-
1935
- s = Series (['some_splits' , 'with_index' ], index = ['preserve' , 'me' ])
1936
- with tm .assert_produces_warning (FutureWarning ):
1937
- result = s .str .split ('_' , return_type = 'frame' )
1938
- exp = DataFrame ({0 : ['some' , 'with' ], 1 : ['splits' , 'index' ]},
1939
- index = ['preserve' , 'me' ])
1940
- tm .assert_frame_equal (result , exp )
1941
-
1942
- with tm .assertRaisesRegexp (ValueError , "expand must be" ):
1943
- with tm .assert_produces_warning (FutureWarning ):
1944
- s .str .split ('_' , return_type = "some_invalid_type" )
1945
-
1946
- def test_split_to_dataframe_expand (self ):
1947
- s = Series (['nosplit' , 'alsonosplit' ])
1948
1909
result = s .str .split ('_' , expand = True )
1949
1910
exp = DataFrame ({0 : Series (['nosplit' , 'alsonosplit' ])})
1950
1911
tm .assert_frame_equal (result , exp )
@@ -1973,8 +1934,7 @@ def test_split_to_dataframe_expand(self):
1973
1934
tm .assert_frame_equal (result , exp )
1974
1935
1975
1936
with tm .assertRaisesRegexp (ValueError , "expand must be" ):
1976
- with tm .assert_produces_warning (FutureWarning ):
1977
- s .str .split ('_' , return_type = "some_invalid_type" )
1937
+ s .str .split ('_' , expand = "not_a_boolean" )
1978
1938
1979
1939
def test_split_to_multiindex_expand (self ):
1980
1940
idx = Index (['nosplit' , 'alsonosplit' ])
@@ -1999,8 +1959,7 @@ def test_split_to_multiindex_expand(self):
1999
1959
self .assertEqual (result .nlevels , 6 )
2000
1960
2001
1961
with tm .assertRaisesRegexp (ValueError , "expand must be" ):
2002
- with tm .assert_produces_warning (FutureWarning ):
2003
- idx .str .split ('_' , return_type = "some_invalid_type" )
1962
+ idx .str .split ('_' , expand = "not_a_boolean" )
2004
1963
2005
1964
def test_rsplit_to_dataframe_expand (self ):
2006
1965
s = Series (['nosplit' , 'alsonosplit' ])
0 commit comments