Answer to Question #145138 in Python for Dharmarajan

Question #145138
Write a python program to create the dataframe and perform Boolean indexing on it.
1
Expert's answer
2020-11-18T06:30:49-0500

# importing pandas as pd

import pandas as pd 

   

# creating dictionary of lists

dict = {'student':["Luis", "Hannah", "Elizabeth", "Clara"], 
        'subject': ["math", "math", "economics", "math"], 
        'score':[90, 60, 80, 98]} 
df = pd.DataFrame(dict, index = [0, 1, 2, 3]) 
mask = df.index == 0
print(df[mask]) 

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS