Saving A Dataframe To Csv File (python)
I am trying to restructure the way my precipitations' data is being organized in an excel file. To do this, I've written the following code: import pandas as pd df = pd.read_excel
Solution 1:
It's all in the docs.
You are interested in skipping the index column, so do:
result.to_csv("output.csv", index=False)
If you also want to skip the header add:
result.to_csv("output.csv", index=False, header=False)
I don't know how your input data looks like (it is a good idea to make it available in your question). But note that currently you can obtain the same results just by doing:
import pandas as pd
df = pd.DataFrame([0]*16)
df.to_csv('results.csv', index=False, header=False)
Post a Comment for "Saving A Dataframe To Csv File (python)"