Mar-17-2022, 10:06 PM
i have list of list
listofplayers = [[player1, 5,1,300,100],[player11, 10,5,650,150],[player23, 17,6,1100,1050]]
and i have a database
player, win, lost, moneywin, moneylost
player1, 3 , 0 , 250 , 50
player2 ...
player3 ...
...
how do i update my database with the new info in my listofplayers? Like this:
player, win, lost, moneywin, moneylost
player1, 5, 1, 300, 100,
player2 ...
player3 ...
player11, 10, 5, 650, 150
player23, 17, 6, 1100, 1050
i tried different things but i just can't find the resources
here's my best attempt:
this is my very first attempt at pandas and i'm still new to programming
listofplayers = [[player1, 5,1,300,100],[player11, 10,5,650,150],[player23, 17,6,1100,1050]]
and i have a database
player, win, lost, moneywin, moneylost
player1, 3 , 0 , 250 , 50
player2 ...
player3 ...
...
how do i update my database with the new info in my listofplayers? Like this:
player, win, lost, moneywin, moneylost
player1, 5, 1, 300, 100,
player2 ...
player3 ...
player11, 10, 5, 650, 150
player23, 17, 6, 1100, 1050
i tried different things but i just can't find the resources
here's my best attempt:
for i in listofplayers for j, k in db.iterrows(): if i[0] == j['player']: index = db.index[db[j]==k].tolist() db.at[index,j] = i[y] index = [] y+=1as you can see i'm having troubles...
this is my very first attempt at pandas and i'm still new to programming