Skip to content
Advertisement

Trouble using index on a list

I am trying to scrape odds from multiple sites but obviously, some sites use different names for different teams. To still be able to handle my data efficiently I want to change my scraped data (team names in this case). I have an excel file with all the team names per site for the premier league and one column with my preferred names. Now I am trying to change the scraped names, which I stored in ‘List’ for now, depending on whether they actually need to be changed. If they need to be changed I want to change them to their corresponding name in the ‘MAIN’ column in my excel file.

but when I try to change the name I can’t find the corresponding correct name as ‘Team_indice’ is a list and not an integer.

JavaScript

NOTE I have tried the following:

Removing .tolist() but then the returned values become of the sort Int64Index, which I also can’t convert to integers. Simply trying int() but if you can answer my question you probably already know there is no way that is working :(

Advertisement

Answer

Try refactoring your code like this:

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement