Viewing and Inspecting Data
head() and tail()The head() and tail() methods are among the first functions you'll use when working with a DataFrame. They allow you to view the first and last few rows of the dataset, respectively.
import pandas as pd
df = pd.read_csv('/content/Car data.csv')
# Viewing the first 5 rows
print(df.head())
# Viewing the last 5 rows print(df.tail())
To get a more detailed understanding of your data, the info() and describe() methods are invaluable.
info() MethodThe info() method provides a concise summary of the DataFrame, including the number of entries, data types, and non-null counts.
# Get a concise summary of the DataFrame print(df.info())
describe() MethodThe describe() method offers a statistical summary of your numerical columns, including metrics like mean, standard deviation, minimum, and maximum values.
# Get a statistical summary of the DataFrame print(df.describe())