From cc5aa7492b6e9ef964aabbf30899019dc7412e0e Mon Sep 17 00:00:00 2001 From: Samuel Oranyeli Date: Sat, 13 May 2023 23:18:00 +1000 Subject: [PATCH] Deprecate the `then` function in favour of using pandas-builtin `.pipe` (#1259) Co-authored-by: Eric Ma --- janitor/functions/then.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/janitor/functions/then.py b/janitor/functions/then.py index d39908d10..3248053b0 100644 --- a/janitor/functions/then.py +++ b/janitor/functions/then.py @@ -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`.