**Examples**

In [1]:

```
import numpy as np
import pandas as pd
```

In [2]:

```
df = pd.DataFrame([[3.0, 2.0],
[4.0, np.nan],
[2.0, 0.0]],
columns=list('XY'))
df
```

Out[2]:

By default, iterates over rows and finds the maximum in each column:

In [3]:

```
df.cummax()
```

Out[3]:

To iterate over columns and find the maximum in each row, use axis=1:

In [4]:

```
df.cummax(axis=1)
```

Out[4]: