-1

My output is [['Cats'],['Dogs']]

I want it as ['Cats', 'Dogs'].

How can I do it?

I got this output while converting rows from CSV file to a list using

df = [list(row) for row in a.values] 

where a is read_csv.

Mark
  • 84,957
  • 6
  • 91
  • 136
  • Just use `df = [s for row in a.values for s in row]` instead. (or `a.values()` in case that's a dict) – Mark May 26 '22 at 23:19
  • 2
    Does this answer your question? [How do I make a flat list out of a list of lists?](https://stackoverflow.com/questions/952914/how-do-i-make-a-flat-list-out-of-a-list-of-lists) – zx485 May 26 '22 at 23:21

0 Answers0