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, 2019 in Python by Esha
7,627 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, 2019 by Suri

Related Questions In Python

–1 vote
1 answer
0 votes
1 answer

Add one row to pandas DataFrame

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

answered Mar 2, 2019 in Python by SDeb
• 13,300 points
1,144 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, 2019 in Python by Siri
664 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 19, 2019 in Python by Taj
• 1,080 points
3,041 views
0 votes
1 answer

How to rename columns in pandas (Python)?

You can use the rename function in ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by MD 2,088 views
0 votes
1 answer

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

The major difference is "size" includes NaN values, ...READ MORE

answered Apr 30, 2018 in Data Analytics by DeepCoder786
• 1,720 points

edited Jun 8, 2020 by Gitika 2,922 views
0 votes
2 answers

Replacing a row in pandas data.frame

key error. I love python READ MORE

answered Feb 18, 2019 in Data Analytics by anonymous
13,792 views
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,660 points
4,599 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, 2019 in Python by Raj
2,825 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, 2019 in Python by Jisha
4,634 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP