1

My dataframe looks like this:

df_dict = {'Title': titles, 'Relase': release, 'Audience Rating': audience_rating,
       'Runtime': runtime, 'Genre': genre, 
       'Votes': votes,  'Director': directors,
       'Actors': actors}
df = pd.DataFrame(df_dict)

This is the Output:

Title   Relase  Audience Rating Runtime Genre   Votes   Director    Actors
0   Sandhippoma (1998)  Not Rated   136 min "
Drama, Romance            " 56  Indrakumar  ['Ambika', 'Sarath Babu', 
'Prakash Raj', 'Radhika Sarathkumar']

1   Joker   (2016)  Not Rated   130 min "
Comedy, Drama            "  2,712   Raju Murugan    ['Raju Saravanan', 'Guru 
Somasundaram', 'Ramya Pandiyan', 'Gayathri']

when doing a df.to_csv only list 'genre' is getting updated as empty. All others are getting written into the csv except 'genre' column

df.to_csv('movies.csv', index=False)

the list 'genre' looks like this:

['\nDrama, Romance            ',
 '\nComedy, Drama            ',
 '\nAction, Biography, Drama            ',]
beth76
  • 11
  • 2
  • "_My dataframe is a dictionary_" makes no sense. It is either a dataframe or a dictionary. – DYZ Feb 25 '20 at 04:59
  • It would help if you could update your question whith a dummy code to generate a (pandas?) dataframe that looks like yours. – Diego Feb 25 '20 at 05:19

0 Answers0