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?

asked Sep 19, 2018 at 17:26
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

answered Sep 19, 2018 at 17:28
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.