How to print pandas Dataframe without index?

0 votes

I have imported a CSV file in Python using pandas. Now when I try to print it, it displays the contents along with the index. I don’t want to print the index. How can I exclude the index and print only the contents?

This is the code I am using

import pandas as pd
filedata = pd.read_csv(“/home/user/data1”)
print (filedata)

Output:

1 Kia

2 Benz

3 Chevvy

4 Bugatti

5 Ford

6 Fiat
Mar 28 in Python by John
70 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You can print the dataframe without index by converting the dataframe to strong with index as false. Try this:

import pandas as pd
filedata = pd.read_csv(“/home/user/data1”)
print (filedata.tostring(index=False))
answered Mar 28 by Shri

Related Questions In Python

0 votes
1 answer

How to print the index of a Pandas Dataframe?

You can do this using the code ...READ MORE

answered May 12 in Python by Usha
9 views
0 votes
1 answer

How to append dataframe without index?

You have to use the ignore_index option. ...READ MORE

answered Apr 1 in Python by Robert
14 views
0 votes
1 answer

How to get value in Pandas dataframe using index?

You can use the iloc method to do ...READ MORE

answered Apr 8 in Python by Rohit
18 views
0 votes
1 answer
0 votes
1 answer

how can i count the items in a list?

suppose you have a list a = [0,1,2,3,4,5,6,7,8,9,10] now ...READ MORE

answered May 2 in Python by Mohammad
• 1,400 points
20 views
+4 votes
6 answers
0 votes
1 answer

How to print one pandas column without index?

There is a slight mistake in what ...READ MORE

answered Mar 28 in Python by Shri
54 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.