取出Dataframe中一行并将其转换为列表

import pandas as pd

order_list = pd.DataFrame(np.array([[12,3,1],[13,4,0],[17,4,5],[16,5,2],[14,3,1]]),
                          columns = ['capacity required','unit returns','time remaining'])

order1 = np.array(order_list.iloc[1])
order1 = order1.tolist()

order_list为

   capacity required  unit returns  time remaining
0                 12             3               1
1                 13             4               0
2                 17             4               5
3                 16             5               2
4                 14             3               1

 order1为

[13, 4, 0]

你可能感兴趣的:(我的记录,机器学习,python)