-
Notifications
You must be signed in to change notification settings - Fork 655
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FEAT-#6498: Make Fold operator more flexible #7257
Conversation
259c1e7
to
c715231
Compare
ab262de
to
e2e8fcb
Compare
def filter_modin_dataframe(df): | ||
return df.__constructor__( | ||
query_compiler=df._query_compiler.filter_func( | ||
fold_axis=0, | ||
new_index=new_index, | ||
new_columns=new_columns, | ||
) | ||
) | ||
|
||
pd.DataFrame.filter_dataframe = filter_modin_dataframe | ||
|
||
filtered_df = modin_df.filter_dataframe() | ||
|
||
df_equals(filtered_df, expected_df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel that filter_modin_dataframe2
will not work. Could you double check?
def filter_modin_dataframe(df): | |
return df.__constructor__( | |
query_compiler=df._query_compiler.filter_func( | |
fold_axis=0, | |
new_index=new_index, | |
new_columns=new_columns, | |
) | |
) | |
pd.DataFrame.filter_dataframe = filter_modin_dataframe | |
filtered_df = modin_df.filter_dataframe() | |
df_equals(filtered_df, expected_df) | |
def filter_modin_dataframe1(df): | |
return df.__constructor__( | |
query_compiler=df._query_compiler.filter_func( | |
fold_axis=0, | |
new_index=new_index, | |
new_columns=new_columns, | |
) | |
) | |
pd.DataFrame.filter_dataframe1 = filter_modin_dataframe1 | |
filtered_df = modin_df.filter_dataframe1() | |
df_equals(filtered_df, expected_df) | |
def filter_modin_dataframe2(df): | |
return df.__constructor__( | |
query_compiler=df._query_compiler.filter_func(fold_axis=0) | |
) | |
pd.DataFrame.filter_dataframe2 = filter_modin_dataframe2 | |
filtered_df = modin_df.filter_dataframe2() | |
df_equals(filtered_df, expected_df) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will not work since I assumed that if new_index/columns are not passed, then fold function must preserve the shape. Do you think we should add a note about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that it is not always possible to know the index when the shape is saved. Let's add an additional flag that will say that the shape does not change. It will default to false so that users are less likely to get an error, on the other hand we can set this parameter to true for our functions that are already implemented through this operator. For example: shape_preserved: bool = False
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good suggestion! Done
@YarShev please resolve conflicts |
Signed-off-by: Igoshev, Iaroslav <[email protected]>
Signed-off-by: Igoshev, Iaroslav <[email protected]>
Signed-off-by: Igoshev, Iaroslav <[email protected]>
Co-authored-by: Anatoly Myachev <[email protected]>
Signed-off-by: Igoshev, Iaroslav <[email protected]>
Co-authored-by: Anatoly Myachev <[email protected]>
Signed-off-by: Igoshev, Iaroslav <[email protected]>
Signed-off-by: Igoshev, Iaroslav <[email protected]>
ea20c46
to
e88864a
Compare
resolved |
What do these changes do?
flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py
black --check modin/ asv_bench/benchmarks scripts/doc_checker.py
git commit -s
docs/development/architecture.rst
is up-to-date