Q. You want to read data from a CSV file in a dataframe but you want to provide your own column names to the dataframe. What additional argument would you specify in read_csv( )?
Answer :-
Names, for example:
import pandas as pd df = pd. read_cav ("Employee.csv", usecols = ['Name', 'Age', 'Salary']) print (df)
Output:-
Name Age Salary
0 Ritesh 25.0 15000.0
1 Aakash 26.0 16000.0
2 NaN NaN NaN
3 Mahima 27.0 20000.0
4 Lakshay 23.0 18000.0
5 Manu 25.0 25000.0
6 Nidhi 26.0 NaN
7 Geetu 30.0 28000.0
>>>
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )