Page 79 - IPP-12-2024
P. 79

key=input("Enter the  Key")
            value=int(input("enter the value"))
            dict[key]=value
            s=pd.Series(dict)
            print (s)
            #change index in series
            s=pd.Series(data,index=[1,2,3])
            print (s)
            #printing head and tail elements
            print(s.head(2))    #displays first 2 elements
            print(s.tail(1))    #displays last 1 elements
            #printing according to index position and condition
            print(s[1])
            print("According to Condition")
            print(s[s==9826386977])
            Output:
            0    a
            1    b
            2    c
            dtype: object
            Enter the values for an array2
            Enter numbers
            num:12
            num:34
            0    12
            1    34
            dtype: int64
            0    a
            1    b
            2    c
            dtype: object
            0                  [0, 1, 2, 3]
            1                  [a, b, c]
            2    [vedant, purnendu, rupali]
            dtype: object
            rupali         [9826386977, rupali@gmail.com]
            purnendu    [9826911972, purnendup@gmail.com]
            vedant             [788990, vedant@gmail.com]
            dtype: object
            Enter the  Key1
            enter the value10
            1    10
            dtype: int64
            1    a
            2    b
            3    c
            dtype: object
   74   75   76   77   78   79   80   81   82   83   84