To write a python program for to read a csv file and find the number of rows and columns present in it.
Import pandas as pd.
Read the CSV file using read_csv method.
Use head and tail method to get the required contents from the file.
Use len() method to get the number of rows and columns.
Print the output.
#Program to read from a csv file and find the number of rows and columns in it
#Developed by: GAUTHAM M G
#Reference number: 212221230027
import pandas as pd
df=pd.read_csv('data.csv')
print(df.head(10))
print(df.tail(5))
print('No. of rows:',len(df.axes[0]))
print('No. of columns:',len(df.axes[1]))
Thus, the program wriiten to read from a csv file and find the number of rows and columns in it.