0

I am writing a CSV file in python using the following line:

data.to_csv(mydata.csv)

Unfortunately, the output presents a useless column as follow:

     Date  median       ori
0  2000-01-31   0.159  0.182900
1  2000-02-29   0.153  0.171349
2  2000-03-31   0.152  0.162461
3  2000-04-30   0.150  0.152306
4  2000-05-31   0.167  0.141220
5  2000-06-30   0.174  0.137749
6  2000-07-31   0.169  0.138802
7  2000-08-31   0.164  0.150315 

How can I get rid of this useless first column?

3

1 Answer 1

3

data.to_csv("mydava.csv", index=False)

That should do it. Here's the documentation.

https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.to_csv.html

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.