diff --git a/modin/core/storage_formats/pandas/query_compiler.py b/modin/core/storage_formats/pandas/query_compiler.py index 7efcb9cc47b..cd0e59ca56f 100644 --- a/modin/core/storage_formats/pandas/query_compiler.py +++ b/modin/core/storage_formats/pandas/query_compiler.py @@ -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} diff --git a/modin/pandas/dataframe.py b/modin/pandas/dataframe.py index ef7899070b8..e90837a3b6d 100644 --- a/modin/pandas/dataframe.py +++ b/modin/pandas/dataframe.py @@ -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") @@ -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") diff --git a/modin/pandas/series.py b/modin/pandas/series.py index 42b664a6ada..11188e85879 100644 --- a/modin/pandas/series.py +++ b/modin/pandas/series.py @@ -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