KnowledgeBoat Logo
|

Informatics Practices

What will be the output of the following code ?

import pandas as pd
myser = pd.Series([0, 0, 0])
print(myser)
  1. 0 0
    0 0
    0 0
  2. 0 1
    0 1
    0 2
  3. 0 0
    1 0
    2 0
  4. 0 0
    1 1
    2 2

Python Pandas

3 Likes

Answer

0 0
1 0
2 0

Reason — The code creates a pandas Series object myser with three elements [0, 0, 0], and when we print the Series, it displays the index along with the corresponding values. Since the Series is created with default indexes (0, 1, 2), the output shows the index values (0, 1, 2) along with the corresponding values (0, 0, 0).

Answered By

1 Like


Related Questions