Q. Assume that required libraries (panda and numpy) are imported and dataframe df2 has been created as per questions.
Q. Predict the output of following code:-
and
Q. Consider the same dictionary my_di, what will be the output produced by following code?
my_di = {"name" : ["Jiya", "Tim", "Rohan"], "age" : np.array([10,15, 20]), "weight": (75,123,239), "height" : [4.5, 5, 6.1], "siblings" : 1, "gender" : "M"}
df2 = pd.DataFrame (my_di, index = my_di ["name"])
print (df2)
Predict the output of following code fragment:
df2["IQ"] = [130, 105, 115]
df2["Married"] = False
print ( df2 )
Answer =
Output:-
name age weight height siblings gender iq married
jiya jiya 10 75 4.5 1 M 130 False
tim tim 15 123 5.0 1 M 105 False
rohan rohan 20 239 6.1 1 M 115 False
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )