Skip to content

Commit

Permalink
FIX-modin-project#2751: remove _map_reduce usage
Browse files Browse the repository at this point in the history
Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Feb 18, 2021
1 parent 33a4b5b commit 8aba0cd
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modin/engines/base/frame/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,10 @@ def dtype_builder(df):

# For now we will use a pandas Series for the dtypes.
if len(self.columns) > 0:
dtypes = self._map_reduce(0, lambda df: df.dtypes, dtype_builder)
reduce_parts = self._frame_mgr_cls.map_axis_partitions(
0, self._partitions, lambda df: df.dtypes
)
dtypes = pandas.concat([x.to_pandas() for x in reduce_parts[0]])
else:
dtypes = pandas.Series([])
# reset name to None because we use "__reduced__" internally
Expand Down Expand Up @@ -1147,10 +1150,13 @@ def _map_reduce(self, axis, map_func, reduce_func=None, preserve_index=True):
else:
reduce_func = self._build_mapreduce_func(axis, reduce_func)

map_parts = self._frame_mgr_cls.map_partitions(self._partitions, map_func)
reduce_parts = self._frame_mgr_cls.map_axis_partitions(
0, self._partitions, lambda df: df.dtypes
axis, map_parts, reduce_func
)
return self._compute_map_reduce_metadata(
axis, reduce_parts, preserve_index=preserve_index
)
return pandas.concat([x.to_pandas() for x in reduce_parts[0]])

def _map(self, func, dtypes=None, validate_index=False, validate_columns=False):
"""Perform a function that maps across the entire dataset.
Expand Down

0 comments on commit 8aba0cd

Please sign in to comment.