Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Anatoly Myachev <anatoliimyachev@mail.com>
  • Loading branch information
noloerino and anmyachev authored Sep 20, 2024
1 parent e784acd commit 3f44816
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
3 changes: 0 additions & 3 deletions modin/core/storage_formats/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,6 @@ def get_axis_len(self, axis: Literal[0, 1]) -> int:
"""
Return the length of the specified axis.
A query compiler may choose to override this method if it has a more efficient way
of computing the length of an axis without materializing it.
Parameters
----------
axis : {0, 1}
Expand Down
11 changes: 4 additions & 7 deletions modin/pandas/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ def dot(self, other) -> Union[DataFrame, Series]: # noqa: PR01, RT01, D200
if isinstance(other, BasePandasDataset):
common = self.columns.union(other.index)
if len(common) > self._query_compiler.get_axis_len(1) or len(common) > len(
other.index
other
):
raise ValueError("Matrices are not aligned")

Expand Down Expand Up @@ -1121,13 +1121,10 @@ def insert(
)
if allow_duplicates is not True and column in self.columns:
raise ValueError(f"cannot insert {column}, already exists")
if (
not -self._query_compiler.get_axis_len(1)
<= loc
<= self._query_compiler.get_axis_len(1)
):
columns_len = self._query_compiler.get_axis_len(1)
if not -columns_len <= loc <= columns_len:
raise IndexError(
f"index {loc} is out of bounds for axis 0 with size {self._query_compiler.get_axis_len(1)}"
f"index {loc} is out of bounds for axis 0 with size {columns_len}"
)
elif loc < 0:
raise ValueError("unbounded slice")
Expand Down
2 changes: 1 addition & 1 deletion modin/pandas/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -966,7 +966,7 @@ def dot(self, other) -> Union[Series, np.ndarray]: # noqa: PR01, RT01, D200
"""
if isinstance(other, BasePandasDataset):
common = self.index.union(other.index)
if len(common) > len(self) or len(common) > len(other.index):
if len(common) > len(self) or len(common) > len(other):
raise ValueError("Matrices are not aligned")

qc = other.reindex(index=common)._query_compiler
Expand Down

0 comments on commit 3f44816

Please sign in to comment.