Getting Information about Optimal Solution from Multi-dimensional Knapsack Algorithm

I am building a multidimensional knapsack algorithm to optimize fantasy NASCAR lineups. I have the code thanks to another author and am now trying to piece back together the drivers the optimal solution consists of. I have written code to do this in the standard case, but am struggling to figure it out with the added dimension. Here's my code:

#open csv file
df = pd.read_csv('roster_kentucky_july18.csv')

print(df.head())

def knapsack2(n, weight, count, values, weights):
    dp = [[[0] * (weight + 1) for _ in range(n + 1)] for _ in range(count + 1)]
    for z in range(1, count + 1):
        for y in range(1, n + 1):
            for x in range(weight + 1):
                if weights[y - 1] <= x:
                    dp[z][y][x] = max(dp[z][y - 1][x],
                                      dp[z - 1][y - 1][x - weights[y - 1]] + values[y - 1])
                else:
                    dp[z][y][x] = dp[z][y - 1][x]

    return dp[-1][-1][-1]

w = 50000
k = 6
values = df['total_pts']
weights = df['cost']
n = len(values)

limit_fmt = 'Max value for weight limit {}, item limit {}: {}'

print(limit_fmt.format(w, k, knapsack2(n, w, k, values, weights))) 

And my output:

              Driver  total_pts  cost
0  A.J. Allmendinger  29.030000  6400
1        Alex Bowman  39.189159  7600
2      Aric Almirola  53.746988  8800
3      Austin Dillon  32.476250  7000
4        B.J. McLeod  14.000000  4700

Max value for weight limit 50000, item limit 6: 325.00072048

I'm looking to at least get the "cost" associated with each "total_pts" in the optimal solution, though it would be nice if I could have it draw out the "Driver" column of the dataframe instead (which I guess could be accessed by indices). Thanks.