janitor.also(df: pandas.core.frame.DataFrame, func: Callable, *args, **kwargs) → pandas.core.frame.DataFrame[source]

Add an arbitrary function with no return value to run in the pyjanitor method chain. This returns the input dataframe instead, not the output of func.

This method does not mutate the original DataFrame.

Example usage:

df = (
    .also(lambda df: print(f"DataFrame shape is: {df.shape}"))
    .also(lambda df: df.to_csv("midpoint.csv"))
        lambda df: print(
            f"Column col_name has these values: {set(df['col_name'].unique())}"
  • df – A pandas dataframe.

  • func – A function you would like to run in the method chain. It should take one DataFrame object as a parameter and have no return. If there is a return, it will be ignored.

  • args – Optional arguments for func.

  • kwargs – Optional keyword arguments for func.


The input pandas DataFrame.