import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from pandas import DataFrame,Series
df = pd.read_csv("shujunew 1")
plt.rcParams['font.sans-serif']=['SimHei']
# df = pd.read_csv("shuju.csv",engine="python")
# print(df)
s = df[["secondType","education"]]
s1 = s.loc[(df["secondType"]=="数据开发")&(df["education"]=="本科")].count()
s11 = s.loc[(df["secondType"]=="数据开发")&(df["education"]=="硕士")].count()
s2 = s.loc[(df["secondType"]=="数据分析")&(df["education"]=="本科")].count()
s22 = s.loc[(df["secondType"]=="数据分析")&(df["education"]=="硕士")].count()
s3 = s.loc[(df["secondType"]=="后端开发")&(df["education"]=="本科")].count()
s33 = s.loc[(df["secondType"]=="后端开发")&(df["education"]=="硕士")].count()
print(s1)
print(s11)
print(s2)
print(s22)
print(s3)
print(s33)
#这里的list集合中只能为常量,不能为变量
list = [324,37,307,33,1014,76]
plt.bar(range(len(list)),list)
plt.savefig("4.png")
plt.show()
python中的柱状图list ,bar的用法
最新推荐文章于 2024-03-11 15:55:18 发布