题型:综合题 题类: 难易度:普通
浙江省A9协作体2023-2024学年高三上学期信息技术暑假返校联考试卷
def cal(s) :
n = len (s)
for i in range(n):
if s[i] == " " : #如果为空格字符
p = i
if s[i] == " :" :
q = i
t = + int(s[q+1:])
return t
图 b
import pandas as pd
import matplotlib.pyplot as plt
df = pd.read_excel("shared bikes.xlsx")
bike = [ "哈罗单车","摩拜单车",
"美团单车","青桔单车"]
sm = [0] * 4
avg = [0] * 4
days = 31
for i in :
t = cal(df.at[i, "结束时间"]) - cal(df.at[i, "开始时间"])
for j in range(4):
if df.at[i, "App 类型"] == bike[j] :
break
for i in range(4):
avg [i] = sm[i] / days
plt.figure(fig size = (12,4))
x = bike
y =
plt.bar (x,y)
plt.show()
n = df.groupby ("App 类型", as_index = True).用户编号.
试题篮