import pandas as pd
import matplotlib.pyplot as plt
df=pd.read_excel("梅西俱乐部详细比赛数据.xlsx")
df['年']=pd.to_datetime(df["时间"]).dt.strftime('%Y').astype(int)
df['月']=pd.to_datetime(df["时间"]).dt.strftime('%m').astype(int)
df['胜负情况']=""
for i in range(len(df)):
f=True;z=0;k=0
for c in df["比分"][i]:
if:
if f:
z=z*10+int(c)
else:
k=k*10+int(c)
else:
f=not f
jlb="巴塞罗那"
if df["年"][i]*100+df["月"][i]>=202108:
if (df["主队"][i]==jlb and z>k) or (df["客队"][i]==jlb and z<k):
df['胜负情况'][i]="胜"
elif z==k:
df['胜负情况'][i]="平"
else:
df['胜负情况'][i]="负"
g=df.groupby(df["年"],as_index=True).count()
g1=df1.groupby(df1["年"],as_index=True).count()
g["胜率"]=g1["胜负情况"]/g["胜负情况"]*100
plt.plot(, marker='∧')
plt.title("2004-2022 梅西俱乐部比赛胜率统计")
plt.show()
方框处代码为 (多选:填字母)