@@ -1902,63 +1902,14 @@ def test_concat_multiindex_dfs_with_deepcopy(self):
1902
1902
result_no_copy = pd .concat (example_dict , names = ['testname' ])
1903
1903
tm .assert_frame_equal (result_no_copy , expected )
1904
1904
1905
- def test_concat_no_unnecessary_upcast (self ):
1906
- # GH 13247
1907
- for pdt in [pd .Series , pd .DataFrame , pd .Panel ]:
1908
- dims = pdt ().ndim
1909
- for dt in np .sctypes ['float' ]:
1910
- dfs = [pdt (np .array ([1 ], dtype = dt , ndmin = dims )),
1911
- pdt (np .array ([np .nan ], dtype = dt , ndmin = dims )),
1912
- pdt (np .array ([5 ], dtype = dt , ndmin = dims ))]
1913
- x = pd .concat (dfs )
1914
- self .assertTrue (x .values .dtype == dt )
1915
-
1916
- for dt in (np .sctypes ['int' ] + np .sctypes ['uint' ]):
1917
- dfs = [pdt (np .array ([1 ], dtype = dt , ndmin = dims )),
1918
- pdt (np .array ([5 ], dtype = dt , ndmin = dims ))]
1919
- x = pd .concat (dfs )
1920
- self .assertTrue (x .values .dtype == dt )
1921
-
1922
- objs = []
1923
- objs .append (pdt (np .array ([1 ], dtype = np .float32 , ndmin = dims )))
1924
- objs .append (pdt (np .array ([1 ], dtype = np .float16 , ndmin = dims )))
1925
- self .assertTrue (pd .concat (objs ).values .dtype == np .float32 )
1926
-
1927
- objs = []
1928
- objs .append (pdt (np .array ([1 ], dtype = np .int32 , ndmin = dims )))
1929
- objs .append (pdt (np .array ([1 ], dtype = np .int64 , ndmin = dims )))
1930
- self .assertTrue (pd .concat (objs ).values .dtype == np .int64 )
1931
-
1932
- # not sure what is the best answer here
1933
- objs = []
1934
- objs .append (pdt (np .array ([1 ], dtype = np .int32 , ndmin = dims )))
1935
- objs .append (pdt (np .array ([1 ], dtype = np .float16 , ndmin = dims )))
1936
- self .assertTrue (pd .concat (objs ).values .dtype == np .float64 )
1937
-
1938
1905
1939
1906
@pytest .mark .parametrize ('pdt' , [pd .Series , pd .DataFrame , pd .Panel ])
1940
1907
@pytest .mark .parametrize ('dt' , np .sctypes ['float' ])
1941
- def test_concat_no_unnecessary_upcast_pytest (dt , pdt ):
1908
+ def test_concat_no_unnecessary_upcast (dt , pdt ):
1942
1909
# GH 13247
1943
1910
dims = pdt ().ndim
1944
1911
dfs = [pdt (np .array ([1 ], dtype = dt , ndmin = dims )),
1945
1912
pdt (np .array ([np .nan ], dtype = dt , ndmin = dims )),
1946
1913
pdt (np .array ([5 ], dtype = dt , ndmin = dims ))]
1947
1914
x = pd .concat (dfs )
1948
1915
assert x .values .dtype == dt
1949
-
1950
- objs = []
1951
- objs .append (pdt (np .array ([1 ], dtype = np .float32 , ndmin = dims )))
1952
- objs .append (pdt (np .array ([1 ], dtype = np .float16 , ndmin = dims )))
1953
- assert pd .concat (objs ).values .dtype == np .float32
1954
-
1955
- objs = []
1956
- objs .append (pdt (np .array ([1 ], dtype = np .int32 , ndmin = dims )))
1957
- objs .append (pdt (np .array ([1 ], dtype = np .int64 , ndmin = dims )))
1958
- assert pd .concat (objs ).values .dtype == np .int64
1959
-
1960
- # not sure what is the best answer here
1961
- objs = []
1962
- objs .append (pdt (np .array ([1 ], dtype = np .int32 , ndmin = dims )))
1963
- objs .append (pdt (np .array ([1 ], dtype = np .float16 , ndmin = dims )))
1964
- assert pd .concat (objs ).values .dtype == np .float64
0 commit comments