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
CodePudding user response:
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')