Skip to content

Commit

Permalink
POND-815 fixes for 21 column dataset (modin-project#50)
Browse files Browse the repository at this point in the history
* POND-815 fixes for 21 column dataset

* Update modin/pandas/base.py

Co-authored-by: helmeleegy <[email protected]>

---------

Co-authored-by: helmeleegy <[email protected]>
  • Loading branch information
2 people authored and vnlitvinov committed Mar 16, 2023
1 parent 163cee5 commit e3be558
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,18 @@ def _build_repr_df(self, num_rows, num_cols):
if len(self.columns) - num_cols_for_front >= 0
else None
)
# Scenario: num_cols = 20, len(self.columns) = 21
# num_cols_for_front works out to 11, num_cols_for_back works out to 11
# this leads to over lap in the columns between the set from the first
# part of the dataframe and the set from the last part of the dataframe.
# The last column from the front is the same as the first column
# from the back. This leads to specifying the same column twice and
# relational databases don't like it.
if num_cols_for_back is not None:
if num_cols_for_front + num_cols_for_back > len(self.columns):
num_cols_for_back -= (
num_cols_for_front + num_cols_for_back - len(self.columns)
)
col_indexer = list(range(len(self.columns))[:num_cols_for_front]) + (
list(range(len(self.columns))[-num_cols_for_back:])
if num_cols_for_back is not None
Expand Down

0 comments on commit e3be558

Please sign in to comment.