- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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
Advertisements