0% found this document useful (0 votes)
6 views1 page

Online Python Compile3r (Interpreter) - Programiz

The document contains Python code snippets demonstrating the use of Pandas Series for various operations. It includes setting values, arithmetic operations, and altering index labels. The code showcases how to manipulate and display data in a Series format.

Uploaded by

suchitnehagarg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views1 page

Online Python Compile3r (Interpreter) - Programiz

The document contains Python code snippets demonstrating the use of Pandas Series for various operations. It includes setting values, arithmetic operations, and altering index labels. The code showcases how to manipulate and display data in a Series format.

Uploaded by

suchitnehagarg
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

4/21/25, 8:28 PM Online Python Compiler (Interpreter) - Programiz

Programiz PRO
Python Online Compiler

main.py Output

22 MonthDays = pd.Series(month_days, index=range(1, 13)) 

23 print(MonthDays)
24 #6. Using the Series created in Question 5, write commands for the following:
25 #a) Set all the values of Vowels to 10 and display the Series.
26 Vowels[:] = 10
27 print(Vowels)
28 #b) Divide all values of Vowels by 2 and display the Series.
29 Vowels = Vowels / 2
30 print(Vowels)
31 #Create another series Vowels1 having 5 elements with index labels 'a', 'e',
'i', 'o', 'u' having values [2, 5, 6, 3, 8] respectively.
32 Vowels1 = pd.Series([2, 5, 6, 3, 8], index=['a', 'e', 'i', 'o', 'u'])
33 print(Vowels1)
34 # Add Vowels and Vowels1 and assign the result to Vowels3.
35 Vowels3 = Vowels + Vowels1
36 print(Vowels3)
37 # Subtract, Multiply and Divide Vowels by Vowels1.
38 Vowels_sub = Vowels - Vowels1
39 print("Subtraction:\n", Vowels_sub)
40
41 Vowels_mul = Vowels * Vowels1
42 print("\nMultiplication:\n", Vowels_mul)
43
44 Vowels_div = Vowels / Vowels1
45 print("\nDivision:\n", Vowels_div)
46 #Alter the labels of Vowels1 to ['A', 'E', 'I', 'O', 'U'].
47 Vowels1.index = ['A', 'E', 'I', 'O', 'U']
48 print(Vowels1) 

Run

https://www.programiz.com/python-programming/online-compiler/ 1/1

You might also like