Add header row in pandas dataframe while printing

0 votes
Hi. I am new to python and Pandas. I have 3 columns in a csv file. I am trying to read and then print it as a dataframe. The data in the csv file does not has a header but I want to print the header while printing the dataframe. How can I do this?
Jul 5 in Python by Esha
772 views

1 answer to this question.

0 votes

Refer to this code:

import pandas as pd
col_name=['Name', 'Age','Gender']
csv_file=pd.read_csv('<csv filename with path to csv file>', name=col_name)
print(csv_file)
answered Jul 5 by Suri

Related Questions In Python

0 votes
1 answer

Add one row to pandas DataFrame

You can try the following : >>> import ...READ MORE

answered Mar 1 in Python by SDeb
• 13,190 points
225 views
0 votes
1 answer

Pandas row in printing whole structure instead of value.

Try this code, it should print only ...READ MORE

answered Mar 28 in Python by Siri
31 views
0 votes
1 answer

How to iterate over row in a Dataframe in Pandas?

Hi, You can use df.iterrows(), it yields both ...READ MORE

answered Jul 18 in Python by Taj
• 1,040 points
58 views
0 votes
1 answer

How to rename columns in pandas (Python)?

It is easy by just adding ".columns" ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
135 views
0 votes
1 answer

What is the Difference in Size and Count in pandas (python)?

The major difference is size includes NaN ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points
757 views
0 votes
2 answers
0 votes
1 answer

Converting a pandas data-frame to a dictionary

Emp_dict=Employee.to_dict('records') You can directly use the 'to_dict()' function ...READ MORE

answered May 23, 2018 in Data Analytics by Bharani
• 4,550 points
1,650 views
0 votes
1 answer

How to append a row to a Pandas dataframe?

You can use the append method provided by pandas ...READ MORE

answered May 9 in Python by Raj
275 views
0 votes
1 answer

How to find the sum of rows in Pandas dataframe?

You can use a combination groupby function with the sum() method. ...READ MORE

answered May 9 in Python by Jisha
391 views