
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Write a Python program to find the maximum value from first four rows in a given series
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
- Related Articles
- Write a program in Python to find the maximum length of a string in a given Series
- Write a program in Python to find the index for NaN value in a given series
- Write a program in Python to remove first duplicate rows in a given dataframe
- Write a program in Python to print the first and last three days from a given time series data
- Write a program in Python to resample a given time series data and find the maximum month-end frequency
- Write a program in Python to slice substrings from each element in a given series
- Write a program in Python to create a panel from a dictionary of dataframe and print the maximum value of the first column
- Write a Python program to shuffle all the elements in a given series
- Write a program in Python to round all the elements in a given series
- Find a pair from the given array with maximum nCr value in Python
- Program to find maximum value at a given index in a bounded array in Python
- Write a program in Python to filter valid dates in a given series
- Write a program in Python to filter armstrong numbers in a given series
- Write a program in Python to find the missing element in a given series and store the full elements in the same series
- Write a program in Python to filter only integer elements in a given series

Advertisements