
(1)按选课要求每位学生都应从物理、化学、生物等七门课中选三门,即“已选科目数”列的值应为“3”,但是从上图中发现“已选科目数”列中有不是“3”的数字,需要该数据进行整理,该数据问题属于
(2)现用Python语言编程统计每所学校各科目选考的总人数,全市各科选考总人数,并按技术选考人数创建图表,如图2,图3所示。代码如下:


import pandas as pd
import itertools #包含了 一 系列迭代器相关的函数和类
import matplotlib.pyplot as plt
import codecs #处理中文 utf-8编 码
from matplotlib.font manager import FontProperties
#读数据到 Pandas 的 DataFrame 结构中
df=pd.read excel("
km=['物理','化学';'生物,'政治';历史,'地理','技术']
zrs=len(df.index) #总人数
#按学校分组计数
sc=df.groupby('学校',asindex=False).count()
result =
result = result.rename(columns={'学生编号:总人数'})#修改“学生编号”为“总人数”
del result['已选科目数']
font=FontProperties(fname=r"c:\windows\fonts\simkai.ttf",size=12)
plt.rcParams["font.sans-serif"]=["KaiTi"]
plt.title("全市技术选考总人数对比情况")
plt.xlabel("学校")
plt.ylabel("技术")
plt.legend( )
plt.show( )
#保存结果
result.toexcel("学校人数统计.xlsx")
根据题意,请在划线处填入合适的语句或表达式

同类型试题

y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2


y = sin x, x∈R, y∈[–1,1],周期为2π,函数图像以 x = (π/2) + kπ 为对称轴
y = arcsin x, x∈[–1,1], y∈[–π/2,π/2]
sin x = 0 ←→ arcsin x = 0
sin x = 1/2 ←→ arcsin x = π/6
sin x = √2/2 ←→ arcsin x = π/4
sin x = 1 ←→ arcsin x = π/2

