Skip to content

problem in the 3_players_dataset_creation code #8

@pierpy

Description

@pierpy

In the last lines of this script

for i in range(fc_players.shape[0]):
if(fc_players['r'][i] == 'P'):
if(fc_players['gk_games'][i] < min_gk_games):
for j in range(fc_players.shape[0]):
if(fc_players['team'][i] == fc_players['team'][j] and fc_players['gk_games'][j] >= min_gk_games):
break

        weight = 1 - (min_gk_games - fc_players['gk_games'][i]) / min_gk_games
        
        fc_players_newgk.at[i, columns_to_avg] = fc_players.loc[i][columns_to_avg] * weight + (1 - weight) * fc_players.loc[j][columns_to_avg]
        
        print(fc_players['name'][i] + ', ' + str(weight))

I get the following error:
pandas.errors.InvalidIndexError: You can only assign a scalar value not a <class 'pandas.core.series.Series'> and I can’t move forward.
Can you help me?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions