Question
Write a program that reads from a CSV file where the separator character is "$". Read only first 5 rows of the dataframe.

Give column headings as Item Name, Quantity, Price.

Make sure to read first row as data and not as column headers.

Answer

import pandas as pd

df = pd.read_csv ("data.csv", sep = "$", names = ["Item

Name", "Quantity", "Price"), header = None, rows 35)

print(df)

Need a full question paper?

Generate a complete, print-ready paper with questions like this in minutes — across 16+ boards, with answer keys.

Start Generating Free