Answer to Question #275543 in Python for Sonu Rathore

Question #275543

With the help panda library create a dataframe using the concept of


dictionary of lists where Keys and Values of dictionary take the data as


mention above in the figure and perform the following operations


a) Print All columns name from the dataframe and change the


b) Display top 7 and bottom 7 rows of first 3 and last 3 columns


c) Write the python code statement to print the value “21-Jan-12” from


dataframe.


d) Write the python code statement to print the values 2nd,4th ,6th , 8th and


10th row for the column “No of Hours”


e) Display the total sum of column total_payout

1
Expert's answer
2021-12-04T12:13:45-0500
import pandas as pd
import numpy as np

exam_data  = {'name': ['Anastasia', 'Dima', 'Katherine', 'James', 'Emily', 'Michael', 'Matthew', 'Laura', 'Kevin', 'Jonas'],
        'score': [12.5, 9, 16.5, np.nan, 9, 20, 14.5, np.nan, 8, 19],
        'attempts': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],
        'qualify': ['yes', 'no', 'yes', 'no', 'no', 'yes', 'yes', 'no', 'no', 'yes']}
labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']

df = pd.DataFrame(exam_data , index=labels)
print(df)





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