I have following simplified data frame from an excel file
Team match1 game12 match3
1 Sandhausen 2 3 1
2 Pohlheim 1 1 6
3 Völklingen 4 2 4
4 Nieder-Olm/Wörrstadt 5 7 2
5 Nümbrecht 7 6 3
6 Dorheim 3 4 7
7 Nienburg/Weser 6 5 5
8 Bad Homburg 8 8 8
9 Bad Homburg 9 9 9
I would like to calculate the best team in total. The data on the match represent the place of the team. To calculate the best team the 1. place get 9 points the 2. place get 8 points and so on. This for all matches.
My problem is that the match1 could be a complete different name is it possible to work with indexes?
Update I use both answers:
to create something like this:
count_row = df.shape[0]
df["score"] = (count_row+1 - df.drop(columns='Team')).sum(axis=1)
df['extra_points'] = (df ==1).sum(axis=1)
df['total'] = df.loc[:,['score','extra_points']].sum(axis=1)
df_total = df.groupby("Team").agg({"total": "sum"}).reset_index().sort_values(by='total', ascending=False)
print(df)
print(df_total)
game12?