From 34cb4868568f3b63bbe949064f9798ce8a1d557c Mon Sep 17 00:00:00 2001 From: Myachev Date: Thu, 4 Aug 2022 21:10:52 +0200 Subject: [PATCH] REFACTOR-#4774: remove '_build_treereduce_func' call from '_compute_dtypes' Signed-off-by: Myachev --- docs/release_notes/release_notes-0.16.0.rst | 1 + modin/core/dataframe/pandas/dataframe/dataframe.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/release_notes/release_notes-0.16.0.rst b/docs/release_notes/release_notes-0.16.0.rst index 72e3f9308a6..2545900e4ed 100644 --- a/docs/release_notes/release_notes-0.16.0.rst +++ b/docs/release_notes/release_notes-0.16.0.rst @@ -46,6 +46,7 @@ Key Features and Updates * REFACTOR-#4708: Delete combine dtypes (#4709) * REFACTOR-#4629: Add type annotations to modin/config (#4685) * REFACTOR-#4717: Improve PartitionMgr.get_indices() usage (#4718) + * REFACTOR-#4774: remove `_build_treereduce_func` call from `_compute_dtypes` (#4775) * REFACTOR-#4750: Delete BaseDataframeAxisPartition.shuffle (#4751) * Pandas API implementations and improvements * FEAT-#4670: Implement convert_dtypes by mapping across partitions (#4671) diff --git a/modin/core/dataframe/pandas/dataframe/dataframe.py b/modin/core/dataframe/pandas/dataframe/dataframe.py index f6880af0988..c1d7c911da8 100644 --- a/modin/core/dataframe/pandas/dataframe/dataframe.py +++ b/modin/core/dataframe/pandas/dataframe/dataframe.py @@ -309,11 +309,13 @@ def _compute_dtypes(self): def dtype_builder(df): return df.apply(lambda col: find_common_type(col.values), axis=0) - map_func = self._build_treereduce_func(0, lambda df: df.dtypes) - reduce_func = self._build_treereduce_func(0, dtype_builder) # For now we will use a pandas Series for the dtypes. if len(self.columns) > 0: - dtypes = self.tree_reduce(0, map_func, reduce_func).to_pandas().iloc[0] + dtypes = ( + self.tree_reduce(0, lambda df: df.dtypes, dtype_builder) + .to_pandas() + .iloc[0] + ) else: dtypes = pandas.Series([]) # reset name to None because we use "__reduced__" internally