Open kad568 opened 1 month ago
old fpl json has defensive and offensive ratings
use seaborn for plotting heatmaps
maybe sort by avg heat rating
To rank a Seaborn heatmap by average heat, you want to reorder the rows or columns based on the average value of the heatmap's data. This involves calculating the average for each row or column and then sorting accordingly. Here's a general approach using Python and Seaborn:
Here's a step-by-step code example:
import seaborn as sns
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
# Sample data for illustration
data = np.random.rand(10, 10) # 10x10 matrix with random values
df = pd.DataFrame(data, columns=[f'Col{i}' for i in range(1, 11)], index=[f'Row{i}' for i in range(1, 11)])
# Calculate the average heat for each row
row_averages = df.mean(axis=1)
# Get the order of rows based on the average heat (from highest to lowest)
row_order = row_averages.sort_values(ascending=False).index
# Reorder the DataFrame based on this order
df_ordered = df.loc[row_order]
# Create the heatmap with reordered rows
sns.heatmap(df_ordered, cmap='viridis', annot=True)
plt.title('Heatmap Ordered by Average Heat')
plt.show()
df
representing the data for the heatmap.df.mean(axis=1)
.df
accordingly.Note: If you want to rank by column averages instead, switch axis=1
to axis=0
when calculating the averages and sort the columns instead of the rows.
i need a stat to compare performance, so i can corelate team strength effects on opposition:
performance could mean xg made, xg conceded, xg difference, g for and against difference
do a scatter plot to get an average effect strength differences has so 50% decrease when vs city for example
imrpoved
weird, the away strength is high in all cases, which does not match intuition
maybe an issue on my end
the actual team starts are in json files hosted online, see:
maybe the same for player.
use these links instead
got data
what makes a team hard to play?