I have a pandas dataframe object that looks like this:
one two three four five 0 1 2 3 4 5 1 1 1 1 1 1
My naive approach would be using iteritems with 'll' as a list of lists and l as a single list.
df = DataFrame({'one':[1,1], 'two':[2,1], 'three':[3,1], 'four':[3,1] }) ll = [] for idx,row in df.iteritems(): l = row.values.tolist() l.insert(0,idx) ll.append(l)