CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

What will be the output of the following code:


import pandas as pd
a = pd.Series([1,2,3,4,5], index = ['A','B','C','D','E',] )
print(a)
print(a-1)
print(a gt=3)
a['A'] = 'Z'
print(a)




Video Solution:


Answer:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pandas as pd
a = pd.Series([1,2,3,4,5], index = ['A','B','C','D','E',] )
print(a)

A    1
B    2
C    3
D    4
E    5
dtype: int64


>>> print(a-1)
A    0
B    1
C    2
D    3
E    4
dtype: int64

>>> print(a>=3)
A    False
B    False
C     True
D     True
E     True
dtype: bool

>>> a['A'] = 'Z'
>>> print(a)
A    Z
B    2
C    3
D    4
E    5

No comments:

Post a Comment