Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I extract this datafram to csv file?

I am trying to extract youtube subtitles to a CSV file(or txt).
I succeeded to drop out the index number and leave the only text in the y column.
However, I am wandering to extract contents to CSV file(or txt).
What code should I type in the last line?

subtitle_out=subtitle.set_index('y')
subtitle_out

subtitle_out_df = pd.DataFrame(subtitle_out)
subtitle_out_df

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

You can use the to_csv() (https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.to_csv.html) method like the following:

subtitle_out_df.to_csv('filename.csv')
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading