w3resource

Pandas DataFrame: pipe() function

DataFrame - pipe() function

The pipe() function is used to apply func(self, *args, **kwargs).

Syntax:

DataFrame.pipe(self, func, *args, **kwargs)

Parameters:

Name Description Type/Default Value Required / Optional
func                      function to apply to the Series/DataFrame. args, and kwargs are passed into func. Alternatively a (callable, data_keyword) tuple where data_keyword is a string indicating the keyword of callable that expects the Series/DataFrame. function Required
args    positional arguments passed into func. iterable Optional
kwargs      a dictionary of keyword arguments passed into func.  mapping Optional

Returns: object - the return type of func.

Notes:

Use .pipe when chaining together functions that expect Series, DataFrames or GroupBy objects. Instead of writing

Example:


Download the above Notebook from here.

Previous: DataFrame - applymap() function
Next: DataFrame - agg() function