I am using PulP to solve a linear programming problem. I am having the following error in the objective function:
TypeError: list indices must be integers or slices, not str
My objective function is
prob += lpSum([routes_vars][man][pa]*costs_distance[man][pa] for (man,pa) in routes)
according to the error message, I think my problem is the costs_distance dictionary that has string values
costs_distance = {'201': {'10267': '167724.1407', '10272': '151859.5908', '10275': '150131.7254', '10277': '153266.1819', '10279': '147949.5275', '10281': '145429.9767', '10283': '144757.2507', '10286': '166474.849', '10288': '152733.6419'}, '2595': {'10267': '186216.5193', '10272': '170351.9694', '10275': '168624.1039', '10277': '171758.5604', '10279': '166441.906', '10281': '163922.3553', '10283': '163249.6293', '10286': '186363.4807', '10288': '171226.0204'},
How can I convert only the dictionary string values ('167724.1407', '151859.5908', '150131.7254'... ) into int values?