Informatics Practices
By default, read_csv() uses the values of first row as column headers in DataFrames. Which argument will you give to ensure that the top/first row's data is used as data and not as column headers ?
Python Pandas
4 Likes
Answer
To ensure that the top/first row's data is used as data and not as column headers in a DataFrame when using the read_csv()
function, we need to use the header
argument and set it to None. The syntax is : <DF> = pandas.read_csv(<filepath>, header = None)
.
Answered By
2 Likes
Related Questions
What all libraries do you require in order to bring data from a CSV file into a DataFrame ?
You want to read data from a CSV file in a DataFrame but you want to provide your own column names to DataFrame. What additional argument would you specify in read_csv() ?
Which argument would you give to read_csv() if you only want to read top 10 rows of data ?
Write command to store data of DataFrame mdf into a CSV file Mydata.csv, with separator character as '@'.