Observe the following code and identify what will be the output? | Pandas Question 2

2. Observe the following code and identify what will be the output?

import pandas as pd
Series1 = pd.Series([10,20,30,40,50])
Series2 = Series1*2 
print(Series1) 
print(Series2)
  1. 1    10
    2    20
    3    30
    4    40
    5    50
    dtype: int64
    1     20
    2     40
    3     60
    3     80
    5    100
    dtype: int64
  2. 0    10
    1    20
    2    30
    3    40
    4    50
    dtype: int64
    0     20
    1     40
    2     60
    3     80
    4    100
    dtype: int64
  3. 0.   10
    1.    20
    2.    30
    3.   40
    4.    50
    dtype: int64
    0.     20
    1.     40
    2.     60
    3.     80
    4.    100
    dtype: int64
  4. 10
    20
    30
    40
    50
    dtype: int64
    20
    40
    60
    80
    100
    dtype: int64

Answer: B)

0    10
1    20
2    30
3    40
4    50
dtype: int64
0     20
1     40
2     60
3     80
4    100
dtype: int64

Explanation:

in the above code, Series1 is having a list of numbers from 10 to 50. Series2 = Series1*2, which means every element of Series1 will be multiplied by 2 and then will print.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.