Devide Pandas dataframe into list of rows containing all columns

Question:

I need to devide Pandas dataframe into list of rows with all columns. That means that if there’s a dataframe with n rows and m columns I need to make a list of n elements and each element should be 1 x m row.

Asked By: eresque-

||

Answers:

It looks like you want:

df.values.tolist()

example:

df = pd.DataFrame([['A', 'B', 'C'],
                   ['D', 'E', 'F']])

df.values.tolist()

output:

[['A', 'B', 'C'],
 ['D', 'E', 'F']]
Answered By: mozway