Advertisements
Advertisements
प्रश्न
Using the Series created in Question 5, write commands for the following:
- Set all the values of Vowels to 10 and display the Series
- Divide all values of Vowels by 2 and display the Series.
- Create another series Vowels1 having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ having values [2,5,6,3,8] respectively.
- Add Vowels and Vowels1 and assign the result to Vowels3
- Subtract, Multiply and Divide Vowels by Vowels1.
- Alter the labels of Vowels1 to [‘A’, ‘E’, ‘I’, ‘O’, ‘U’].
कोड लेखन
Advertisements
उत्तर
import pandas as pd
Vowels = pd.Series([0, 0, 0, 0, 0], index=['a', 'e', 'i', 'o', 'u'])
Vowels[:] = 10
print(Vowels)
print(Vowels / 2)
Vowels1 = pd.Series([2, 5, 6, 3, 8], index=['a', 'e', 'i', 'o', 'u'])
Vowels3 = Vowels + Vowels1
print(Vowels3)
print(Vowels - Vowels1)
print(Vowels * Vowels1)
print(Vowels / Vowels1)
Vowels1.index = ['A', 'E', 'I', 'O', 'U']
print(Vowels1)shaalaa.com
क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
