मराठी

Using the Series created in Question 5, write commands for the following: a) Set all the values of Vowels to 10 and display the Series b) Divide all values of Vowels by 2 and display the Series.

Advertisements
Advertisements

प्रश्न

Using the Series created in Question 5, write commands for the following:

  1. Set all the values of Vowels to 10 and display the Series
  2. Divide all values of Vowels by 2 and display the Series.
  3. Create another series Vowels1 having 5 elements with index labels ‘a’, ‘e’, ‘i’, ‘o’ and ‘u’ having values [2,5,6,3,8] respectively.
  4. Add Vowels and Vowels1 and assign the result to Vowels3
  5. Subtract, Multiply and Divide Vowels by Vowels1.
  6. 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
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 2: Data Handling using Pandas - I - Exercise [पृष्ठ ६०]

APPEARS IN

एनसीईआरटी Informatics Practices [English] Class 12
पाठ 2 Data Handling using Pandas - I
Exercise | Q 6. | पृष्ठ ६०
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×