Q:

From the given dataset print the first and last five rows using python programming

belongs to collection: Python Pandas Exercises

1

From the given dataset print the first and last five rows

Expected Output:

Python Pandas printing first 5 rows
Python Pandas printing first 5 rows
Python Pandas printing last 5 rows
Python Pandas printing last 5 rows

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Solution:

Print first five rows

import pandas as pd
df = pd.read_csv("D:\\Python\\Articles\\pandas\\automobile-dataset\\Automobile_data.csv")
df.head(5)

Print last five rows

import pandas as pd
df = pd.read_csv("D:\\Python\\Articles\\pandas\\automobile-dataset\\Automobile_data.csv")
df.tail(5)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Clean the dataset and update the CSV file using py... >>