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()
A.g["年"],g["胜率"] B.g["年"],g.胜率 C.g.index,g["胜率"] D.g.index,g.胜率
A.![]() | B.![]() |
C.![]() | D.![]() |
⑴
⑶
A.①④③ | B.③⑤① | C.②④① | D.①⑤② |
A.46 | B.58 | C.69 | D.81 |
A.3 | B.4 | C.6 | D.8 |
卦名 | 乾 | 兑 | 离 | 震 | 巽 | 坎 | 艮 | 坤 |
卦象 | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
卦象代码 | 111 | 011 | 101 | 001 | 110 | 010 | 100 | 000 |
def DtoB(num):
result = ''
r = 0
while num > 0:
r = num%2
num //= 2
return result
letters = Bcode = ch = strbg = ''
bg = {'111':' 乾 ','011':'兑','101':' 离','001':'震','110':'巽 ','010':'坎','100':' 艮 ','000':'坤'}
letters = input('请输入三个大小写字母: ')
for i in range(len(letters)):
ch = letters[i]
count = 0
Bcode =
for i in range(len(Bcode)):
if Bcode[i] == '1':
count +=1
if
strbg+='1'
else:
strbg+='0'
print('相应卦名为:'+bg[strbg])
![]() 图 a |
![]() 图 b |
实现上述功能的Python程序如下,请在划线处填入合适的代码。
import pandas as pd
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif']=['SimHei'] #显示中文字符, 字体为黑体
df=pd.read_excel ("
pjf=df.groupby("班级",as_index=False).mean()
pjf=
df1=pjf.sort_values
plt.figure()
x=df1.班级
y=df1.题 5
plt.bar (x,y,label="各班题 5 平均得分")
for i,j in zip(x,y): #设置图表标签
plt.text(i,j+0.05,'%0.2f'%j,ha='center')
plt.show ( )
import random
a=[0]*6
for i in range(1,6):
tmp=random.randint(5,24)
if tmp%2==0 or i%2==1:
a[i]=a[i-1]+tmp
print(a)
运行程序后,数组a的值可能的是( )
A.[0, 9, 29, 50, 0, 20] | B.[8, 20, 44, 62, 86, 109] |
C.[0, 8, 14, 21, 39, 0] | D.[0, 10, 24, 43, 0, 30] |
import random
n=random.randint(50,100)
a=[]
for i in range(2,n+1):
while n%i==0:
a.append(i)
n=n//i
print(a)
A.[2,2,9] | B.[3,3,3,5] | C.[2,4,7] | D.[53] |