Q. Assume that required libraries (Pandas and Numpy) are imported and dataframe ndf has been created as shown in photo.


 

Dataframe


Predict the output produced by following code fragment:


print (ndf[ndf["age"] > 30])

print(ndf.head(2))

print(ndf.tail(3))


Answer =

Output:-

       Name sex position       city  age  project  budget
1     evan   m    progr   new delhi   40        2      22
4  jaspret   m  program  bangalore   32        2      22
5     suji   f  program  bangalore   32       32      22

print(ndf.head(2))

    Name sex position       city  age  project  budget
0  rabia   f  manager  bangalore   20       12      20
1   evan   m    progr  new delhi   22        2      22


print(ndf.tail(2+1))
      Name sex position       city  age  project  budget
3    lalit   m  manager      mumba   20       14      20
4  jaspret   m  program  bangalore   22        2      22
5     suji   f  program  bangalore   22       32      22

Post a Comment

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

Previous Post Next Post