I have the following code I wrote:
df = pandas.DataFrame(temp_data_list) return [X(first, rest.tolist()) for first, rest in df.iterrows()] The temp_data_list is a list of lists for example [['a',1,2,3],['b',3,2,1]]. I want to convert it to DataFrame and iterate over iterrows and for each element, insert the 'a' to be first and the rest should be [1,2,3]. For some reason it inserts 'a' to the rest. How can I make it work?
没有评论:
发表评论