cudf.DataFrame.pipe#

DataFrame.pipe(func, *args, **kwargs)[source]#

Apply func(self, *args, **kwargs).

Parameters:
funcfunction

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.

argsiterable, optional

Positional arguments passed into func.

kwargsmapping, optional

A dictionary of keyword arguments passed into func.

Returns:
objectthe return type of func.

Examples

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

>>> import cudf
>>> df = cudf.DataFrame({'a': [1, 2, 3]})
>>> def add_one(x):
...     return x + 1
>>> df.pipe(add_one)
   a
0  2
1  3
2  4