相对状态计算方法
数据
import matplotlib.pyplot as plt
import numpy as np
# 使用支持中文的字体
plt.rcParams['font.family'] = ['Microsoft YaHei'] # 设置字体为微软雅黑
plt.rcParams['axes.unicode_minus'] = False # 正确显示负号
# 数据
teams = ['町田泽维亚', '鹿岛鹿角', '大阪钢巴', '神户胜利船', '广岛三箭', '东京FC', '名古屋鲸鱼', '浦和红钻',
'大阪樱花', '福冈黄蜂', '东京绿茵', '柏太阳神', '横滨水手', '川崎前锋', '新泻天鹅', '磐田喜悦',
'鸟栖砂岩', '湘南海洋', '京都不死鸟', '札幌冈萨多']
ppg_last_8 = [2.00, 2.75, 2.00, 1.63, 1.25, 1.75, 1.25, 1.75, 0.88, 1.75, 1.88, 1.00, 0.88, 1.50, 0.88, 1.00, 1.25, 1.00, 0.63, 0.63]
ppg_overall = [2.06, 2.06, 1.82, 1.76, 1.63, 1.53, 1.53, 1.47, 1.47, 1.47, 1.41, 1.29, 1.33, 1.18, 1.12, 1.06, 0.88, 0.82, 0.65, 0.65]
计算百分比变化
# 计算百分比变化
percentage_change = [(last - overall) / overall * 100 for last, overall in zip(ppg_last_8, ppg_overall)]
👇完整示例