Q:

Write a Pandas program to find the index of the first occurrence of the smallest and largest value of a given series

0

Write a Pandas program to find the index of the first occurrence of the smallest and largest value of a given series

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import pandas as pd
nums = pd.Series([1, 3, 7, 12, 88, 23, 3, 1, 9, 0])
print("Original Series:")
print(nums)
print("Index of the first occurrence of the smallest and largest value of the said series:")
print(nums.idxmin())
print(nums.idxmax())

Sample Output:

Original Series:
0     1
1     3
2     7
3    12
4    88
5    23
6     3
7     1
8     9
9     0
dtype: int64
Index of the first occurrence of the smallest and largest value of the said series:
9
4

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now