Skip to main content

Posts

Showing posts with the label 13. Create a data frame for examination results and display row labels

ads1

13. Create a data frame for examination results and display row labels, column labels data types of each column and the dimensions.

  13. Create a data frame for examination results and display row labels, column labels data types of each column and the dimensions. Solution :- import pandas as pd res={'Amit':[76,78,75,66,68],         'Shialesh':[78,56,77,49,55],         'Rani':[90,91,93,97,99],         'Madan':[55,48,59,60,66],         'Radhika':[78,79,85,88,86]} df=pd.DataFrame(res) print("Prinitng row labels in a list:") print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") idx=df.index l=list(idx) print(l) print("Prinitng row labels in a list:") print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~") print("[",end=" ") for col in df.columns:         print(col,end=" ")         print("]")         print("Printing Data Types of each column")         print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")         print(df.dtypes)         print("Printing dimensions of Data Frame")         print("~~~~~~~~~~~~~~~

ads2