Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REFACTOR-#4774: remove _build_treereduce_func call from _compute_dtypes #4775

Merged
merged 1 commit into from
Aug 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/release_notes/release_notes-0.16.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 5 additions & 3 deletions modin/core/dataframe/pandas/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down