This function will apply an optional remediation to a dataframe, based on the user input.
(
df: pd.DataFrame, remediation: Remediation, auto_accept: bool
)
| 572 | |
| 573 | |
| 574 | def apply_optional_remediation( |
| 575 | df: pd.DataFrame, remediation: Remediation, auto_accept: bool |
| 576 | ) -> tuple[pd.DataFrame, bool]: |
| 577 | """ |
| 578 | This function will apply an optional remediation to a dataframe, based on the user input. |
| 579 | """ |
| 580 | optional_applied = False |
| 581 | input_text = f"- [Recommended] {remediation.optional_msg} [Y/n]: " |
| 582 | if remediation.optional_msg is not None: |
| 583 | if accept_suggestion(input_text, auto_accept): |
| 584 | assert remediation.optional_fn is not None |
| 585 | df = remediation.optional_fn(df) |
| 586 | optional_applied = True |
| 587 | if remediation.necessary_msg is not None: |
| 588 | sys.stdout.write(f"- [Necessary] {remediation.necessary_msg}\n") |
| 589 | return df, optional_applied |
| 590 | |
| 591 | |
| 592 | def estimate_fine_tuning_time(df: pd.DataFrame) -> None: |
no test coverage detected