1

I have a Data Frame with one column consisting of Names
When i access the names from the dataframe as

filename = frcl.iloc[[i]]
file = open(''+str(filename)+'.csv', 'w')

It creates CSV file with name with index and header in the CSV File Name
Eg; if i have Apple and Bat in Dataframe it creates csv file with 00Apple.csv and 01Bat.csv
how to take dataframe content with out index and header?

1 Answer 1

2

You can use panda's method to_string() and specify the argument index=False to avoid including the row's index.

filename = frcl.iloc[[i]].to_string(index=False)
file = open(''+filename+'.csv', 'w')
Sign up to request clarification or add additional context in comments.

1 Comment

filename = frcl.iloc[[i]].to_string(index=False,header=0) This worked thank you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.