Skip to content

Commit

Permalink
Avoid columns computation on 'df.columns ='
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Chigarev <dmitry.chigarev@intel.com>
  • Loading branch information
dchigarev committed Aug 16, 2023
1 parent 75e04bd commit 76c538f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions modin/core/dataframe/pandas/dataframe/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ def _compute_axis_labels_and_lengths(self, axis: int, partitions=None):
List of int
Size of partitions alongside specified `axis`.
"""

if partitions is None:
partitions = self._partitions
new_index, internal_idx = self._partition_mgr_cls.get_indices(axis, partitions)
Expand Down
3 changes: 2 additions & 1 deletion modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,8 @@ def __setattr__(self, key, value):
# before it appears in __dict__.
if key in ("_query_compiler", "_siblings", "_cache") or key in self.__dict__:
pass
elif key in self and key not in dir(self):
# we have to check for the key in `dir(self)` first in order not to trigger columns computation
elif key not in dir(self) and key in self:
self.__setitem__(key, value)
# Note: return immediately so we don't keep this `key` as dataframe state.
# `__getattr__` will return the columns not present in `dir(self)`, so we do not need
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ tag_prefix =
parentdir_prefix = modin-

[tool:pytest]
addopts = --disable-pytest-warnings --cov-config=setup.cfg --cov=modin --cov-append --cov-report=
addopts = --disable-pytest-warnings
xfail_strict=true
markers =
xfail_executions
Expand Down

0 comments on commit 76c538f

Please sign in to comment.