pandas中关于DataFrame行,列显示不完全(省略)的解决办法
#显示所有列
pd.set_option(‘display.max_columns’, None)
#显示所有行
pd.set_option(‘display.max_rows’, None)
#设置value的显示长度为100,默认为50
pd.set_option(‘max_colwidth’,100)
import matplotlib.pyplot as plt
# 设置中文字体和负号正常显示
matplotlib.rcParams['font.sans-serif'] = ['SimHei']
matplotlib.rcParams['axes.unicode_minus'] = False
d1 = pd.read_excel(r'D:\个人资料\直方图.xlsx')
label_list = list(d1['供应商'].values) # 横坐标刻度显示值
num_list1 = list(d1['基金id'].values) # 纵坐标值1
#num_list2 = [15, 30, 40, 20] # 纵坐标值2
x = range(len(num_list1))
# 绘制条形图
rects1 = plt.bar(x, height=num_list1, color='red', label='供应商')
#rects2 = plt.bar([i+0.4 for i in x], height=num_list2, width=0.4, color='green', label='部门二')
# 设置y轴属性
#plt.ylim(0, 50)
plt.ylabel('基金数量')
# 设置x轴属性
plt.xticks([index+0.2 for index in x], label_list)
plt.xlabel("年份")
plt.title('基金管理公司的基金数量')
plt.legend()
# 显示文本
for rect in rects1:
height = rect.get_height()
plt.text(rect.get_x() + rect.get_width() / 2, height + 1, str(height), ha='center', va='bottom')
#for rect in rects2:
# height = rect.get_height()
# plt.text(rect.get_x() + rect.get_width() / 2, height + 1, str(height), ha='center', va='bottom')
plt.show()