1# iterate using this syntax where df is the pandas.DataFrame
2# N. B.: a single tuple is composed by the row index
3# and the values of the dataframe columns
4
5for row in df.itertuples():
6 # do your stuff here
7
1
2import pandas as pd
3
4
5def sum(x, y, z, m):
6 return (x + y + z) * m
7
8
9df = pd.DataFrame({'A': [1, 2], 'B': [10, 20]})
10
11df1 = df.apply(sum, args=(1, 2), m=10)
12print(df1)
13