Q. Write a program to display number of rows and number of columns in DataFrame df without using shape attribute.


Answer :-


import pandas as pd
# Series object df created or loaded
rows = len(df.axes[0])
cols = len(df.axes[1])
print("No. of rows:", rows)
print("No. of columns: ", cols)

Post a Comment

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

Previous Post Next Post