@@ -1859,7 +1859,7 @@ def construction_error(
1859
1859
# -----------------------------------------------------------------------
1860
1860
1861
1861
1862
- def _grouping_func (tup ) :
1862
+ def _grouping_func (tup : tuple [ int , ArrayLike ]) -> tuple [ bool , DtypeObj ] :
1863
1863
# compat for numpy<1.21, in which comparing a np.dtype with an ExtensionDtype
1864
1864
# raises instead of returning False. Once earlier numpy versions are dropped,
1865
1865
# this can be simplified to `return tup[1].dtype`
@@ -1911,49 +1911,6 @@ def _form_blocks(arrays: list[ArrayLike], consolidate: bool) -> list[Block]:
1911
1911
return nbs
1912
1912
1913
1913
1914
- def simple_blockify (tuples , dtype , consolidate : bool ) -> list [Block ]:
1915
- """
1916
- return a single array of a block that has a single dtype; if dtype is
1917
- not None, coerce to this dtype
1918
- """
1919
- if not consolidate :
1920
- return _tuples_to_blocks_no_consolidate (tuples , dtype = dtype )
1921
-
1922
- values , placement = _stack_arrays (tuples , dtype )
1923
-
1924
- # TODO: CHECK DTYPE?
1925
- if dtype is not None and values .dtype != dtype : # pragma: no cover
1926
- values = values .astype (dtype )
1927
-
1928
- block = new_block (values , placement = BlockPlacement (placement ), ndim = 2 )
1929
- return [block ]
1930
-
1931
-
1932
- def multi_blockify (tuples , dtype : DtypeObj | None = None , consolidate : bool = True ):
1933
- """return an array of blocks that potentially have different dtypes"""
1934
-
1935
- if not consolidate :
1936
- return _tuples_to_blocks_no_consolidate (tuples , dtype = dtype )
1937
-
1938
- # group by dtype
1939
- grouper = itertools .groupby (tuples , lambda x : x [1 ].dtype )
1940
-
1941
- new_blocks = []
1942
- for dtype , tup_block in grouper :
1943
-
1944
- # error: Argument 2 to "_stack_arrays" has incompatible type
1945
- # "Union[ExtensionDtype, str, dtype[Any], Type[str], Type[float], Type[int],
1946
- # Type[complex], Type[bool], Type[object], None]"; expected "dtype[Any]"
1947
- values , placement = _stack_arrays (
1948
- list (tup_block ), dtype # type: ignore[arg-type]
1949
- )
1950
-
1951
- block = new_block (values , placement = BlockPlacement (placement ), ndim = 2 )
1952
- new_blocks .append (block )
1953
-
1954
- return new_blocks
1955
-
1956
-
1957
1914
def _tuples_to_blocks_no_consolidate (tuples , dtype : DtypeObj | None ) -> list [Block ]:
1958
1915
# tuples produced within _form_blocks are of the form (placement, array)
1959
1916
if dtype is not None :
0 commit comments