Q. Write a program that reads from a CSV file where the separator character is '$'. Read only the first 5 rows in your dataframe. Give column headings as ItemName, Quantity, Price. Make sure to read the first row as data and not as column headers.


Answer :-


import pandas as pd
df = pd. read_csv ("data.csv", sep="$", names = ["ItemName", "Quantity", "Price"], header = None, nrows = 5)
print (df)

Post a Comment

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

Previous Post Next Post