Skip to content
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

[ENH]deprecate then function #1259

Merged
merged 2 commits into from
May 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions janitor/functions/then.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,25 @@
from typing import Callable
import pandas_flavor as pf
import pandas as pd
from janitor.utils import refactored_function


@pf.register_dataframe_method
@refactored_function(
message="This function will be deprecated in a 1.x release. "
"Kindly use `pd.DataFrame.pipe` instead."
)
@pf.register_dataframe_method
def then(df: pd.DataFrame, func: Callable) -> pd.DataFrame:
"""Add an arbitrary function to run in the `pyjanitor` method chain.

This method does not mutate the original DataFrame.

!!!note

This function will be deprecated in a 1.x release.
Please use `pd.DataFrame.pipe` instead.

Examples:
A trivial example using a lambda `func`.

Expand Down