Q. Given a DataFrame df:


    Age    Name    Weight
0    15    Arnav    42
1    22    Charles    75
2    35    Guru    66

Write a program to display only the Weight of first and third rows.


Answer :-


import pandas as pd
: # Series object df created or loaded
print (df.iloc[ [0,2], [2]])


Output :-

    Weight
0  42
2  66

>>>

Post a Comment

You can help us by Clicking on ads. ^_^
Please do not send spam comment : )

Previous Post Next Post