0 points

Pandas DataFrame apply() - sending arguments examples


dashboard

Sat Aug 15 2020 13:59:11 GMT+0000 (UTC)

Posted by @arielvol

import pandas as pd


def sum(x, y, z, m):
    return (x + y + z) * m


df = pd.DataFrame({'A': [1, 2], 'B': [10, 20]})

df1 = df.apply(sum, args=(1, 2), m=10)
print(df1)
content_copy Copy

https://www.journaldev.com/33478/pandas-dataframe-apply-examples