Input −
Assume, you have a Series,
0 11 1 12 2 66 3 24 4 80 5 40 6 28 7 50
Output −
Maximum value for first four row is 66.
Solution
To solve this, we will follow the steps given below −
Define a Series
Set rows value as data.iloc[0:4].
Finally, find the max value from the rows series.
Example
Let us see the complete implementation to get a better understanding −
import pandas as pd l = [11,12,66,24,80,40,28,50] data = pd.Series(l) rows = data.iloc[0:4] print(rows.max())
Output
66