Skip to content

Commit

Permalink
fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
noloerino committed Jul 22, 2024
1 parent ad02646 commit 7f82b6d
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 5 deletions.
11 changes: 9 additions & 2 deletions modin/core/storage_formats/base/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,6 @@ class BaseQueryCompiler(
lazy_column_count : bool, default False
True if the backend defers computations of the number of columns (`len(df.columns)`).
Used by the frontend to avoid unnecessary execution or defer error validation.
lazy_shape : bool
True if either lazy_row_count or lazy_column_count is True.
_shape_hint : {"row", "column", None}, default: None
Shape hint for frames known to be a column or a row, otherwise None.
Expand Down Expand Up @@ -218,6 +216,15 @@ def default_to_pandas(self, pandas_op, *args, **kwargs) -> Self:

@property
def lazy_shape(self):
"""
Whether either of the underlying dataframe's dimensions (row count/column count) are computed lazily.
If True, the frontend should avoid length/shape checks as much as possible.
Returns
-------
bool
"""
return self.lazy_row_count or self.lazy_column_count

_shape_hint = None
Expand Down
49 changes: 46 additions & 3 deletions modin/core/storage_formats/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,22 +277,67 @@ def __init__(self, modin_frame: PandasDataframe, shape_hint: Optional[str] = Non

@property
def lazy_row_labels(self):
"""
Whether the row labels are computed lazily.
Equivalent to `not self.frame_has_materialized_index`.
Returns
-------
bool
"""
return not self.frame_has_materialized_index

@property
def lazy_row_count(self):
"""
Whether the row count is computed lazily.
Equivalent to `not self.frame_has_materialized_index`.
Returns
-------
bool
"""
return not self.frame_has_materialized_index

@property
def lazy_column_types(self):
"""
Whether the dtypes are computed lazily.
Equivalent to `not self.frame_has_materialized_dtypes`.
Returns
-------
bool
"""
return not self.frame_has_materialized_dtypes

Check warning on line 315 in modin/core/storage_formats/pandas/query_compiler.py

View check run for this annotation

Codecov / codecov/patch

modin/core/storage_formats/pandas/query_compiler.py#L315

Added line #L315 was not covered by tests

@property
def lazy_column_labels(self):
"""
Whether the column labels are computed lazily.
Equivalent to `not self.frame_has_materialized_columns`.
Returns
-------
bool
"""
return not self.frame_has_materialized_columns

@property
def lazy_column_count(self):
"""
Whether the column count is are computed lazily.
Equivalent to `not self.frame_has_materialized_columns`.
Returns
-------
bool
"""
return not self.frame_has_materialized_columns

def finalize(self):
Expand Down Expand Up @@ -1803,9 +1848,7 @@ def get_unique_level_values(index):
new_index = (
get_unique_level_values(index)
if consider_index
else index
if isinstance(index, list)
else [index]
else index if isinstance(index, list) else [index]
)

new_columns = (
Expand Down

0 comments on commit 7f82b6d

Please sign in to comment.