I am trying to re-write this code, which was written a while ago.
It has multiple chuncks, hence, I separated it into smaller pieces and re-write step by step. For instance, converting .ix to iloc, etc.
This chunk gives me an error:
#Loop through all rows, skip the user column, and fill with similarity scores
for i in range(0,len(data_sims.index)):
for j in range(1,len(data_sims.columns)):
user = data_sims.index[i]
product = data_sims.columns[j]
if data.iloc[i][j] == 1:
data_sims.iloc[i][j] = 0
else:
product_top_names = data_neighbours.iloc[product][1:10]
product_top_sims = data_ibs.iloc[product].order(ascending=False)[1:10]
user_purchases = data_germany.iloc[user,product_top_names]
data_sims.iloc[i][j] = getScore(user_purchases,product_top_sims)
Get an error
TypeError: Cannot index by location index with a non-integer key
I guess there is something here, which requires updating, but cannot find what exactly. I do not think it is about data. It is just about updating the code.
Appreciate any tips!