Skip to content

Commit

Permalink
PERF-#6976: Do not trigger unnecessary computations on `._propagate_i…
Browse files Browse the repository at this point in the history
…ndex_objs()` (#6977)

Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
  • Loading branch information
dchigarev committed Feb 29, 2024
1 parent b3e79ed commit 9adaf33
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions modin/core/dataframe/pandas/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ def _propagate_index_objs(self, axis=None):
axis : int, default: None
The axis to apply to. If it's None applies to both axes.
"""
self._filter_empties()
self._filter_empties(compute_metadata=False)
if axis is None or axis == 0:
cum_row_lengths = np.cumsum([0] + self.row_lengths)
if axis is None or axis == 1:
Expand Down Expand Up @@ -931,7 +931,11 @@ def apply_idx_objs(df, idx):
slice(cum_row_lengths[i], cum_row_lengths[i + 1])
],
length=self.row_lengths[i],
width=self.column_widths[j],
width=(
self.column_widths[j]
if self._column_widths_cache is not None
else None
),
)
for j in range(len(self._partitions[i]))
]
Expand All @@ -952,7 +956,11 @@ def apply_idx_objs(df, cols):
cols=self.columns[
slice(cum_col_widths[j], cum_col_widths[j + 1])
],
length=self.row_lengths[i],
length=(
self.row_lengths[i]
if self._row_lengths_cache is not None
else None
),
width=self.column_widths[j],
)
for j in range(len(self._partitions[i]))
Expand Down

0 comments on commit 9adaf33

Please sign in to comment.