Skip to content

Commit

Permalink
PERF-#6718: Use '_get_axis_lengths' func instead of '_axes_lengths' p…
Browse files Browse the repository at this point in the history
…roperty (#6719)

Signed-off-by: Anatoly Myachev <[email protected]>
  • Loading branch information
anmyachev authored Nov 7, 2023
1 parent f436a30 commit 90ec679
Showing 1 changed file with 2 additions and 14 deletions.
16 changes: 2 additions & 14 deletions modin/core/dataframe/pandas/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,6 @@ def column_widths(self):
self._column_widths_cache = []
return self._column_widths_cache

@property
def _axes_lengths(self):
"""
Get a pair of row partitions lengths and column partitions widths.
Returns
-------
list
The pair of row partitions lengths and column partitions widths.
"""
return [self.row_lengths, self.column_widths]

def _set_axis_lengths_cache(self, value, axis=0):
"""
Set the row/column lengths cache for the specified axis.
Expand Down Expand Up @@ -1973,7 +1961,7 @@ def _compute_tree_reduce_metadata(self, axis, new_parts, dtypes=None):
new_axes[axis ^ 1] = self.get_axis(axis ^ 1)

new_axes_lengths[axis] = [1]
new_axes_lengths[axis ^ 1] = self._axes_lengths[axis ^ 1]
new_axes_lengths[axis ^ 1] = self._get_axis_lengths(axis ^ 1)

if dtypes == "copy":
dtypes = self.copy_dtypes_cache()
Expand Down Expand Up @@ -3443,7 +3431,7 @@ def _copartition(self, axis, other, how, sort, force_repartition=False):
reindexed_base = base_frame._partitions
base_lengths = base_frame.column_widths if axis else base_frame.row_lengths

others_lengths = [o._axes_lengths[axis] for o in other_frames]
others_lengths = [o._get_axis_lengths(axis) for o in other_frames]

# define conditions for reindexing and repartitioning `other` frames
do_reindex_others = [
Expand Down

0 comments on commit 90ec679

Please sign in to comment.