Python Matplotlib崩溃
我尝试使用matplotlib学习数据可视化,但每当我尝试plot函数时,它总是崩溃:Python Matplotlib崩溃,python,matplotlib,Python,Matplotlib,我尝试使用matplotlib学习数据可视化,但每当我尝试plot函数时,它总是崩溃: >>> import pylab >>> import numpy as np >>> import pandas as pd >>> names1880 = pd.read_csv('/root/yob1880.txt', names=['name', 'sex', 'births']) >>> pieces = [
>>> import pylab
>>> import numpy as np
>>> import pandas as pd
>>> names1880 = pd.read_csv('/root/yob1880.txt', names=['name', 'sex', 'births'])
>>> pieces = []
>>> for year, group in names.groupby(['year', 'sex']):
... pieces.append(group.sort_index(by='births', ascending=False)[:1000])
... top1000 = pd.concat(pieces, ignore_index=True)
>>> table = top1000.pivot_table(rows='year', cols='sex', aggfunc=sum)
>>> table.plot(title='Sum of table1000 by year and sex',
yticks=np.linspace(0, 1.2, 13), xticks=range(1880, 2020, 10))
Qt: Session management error: None of the authentication protocols specified are supported
<matplotlib.axes.AxesSubplot object at 0x3063610>
导入pylab
>>>将numpy作为np导入
>>>作为pd进口熊猫
>>>names1880=pd.read_csv('/root/yob1880.txt',names=['name','sex','birtions'])
>>>件数=[]
>>>对于年份,以名称分组。groupby(['year','sex']):
... pieces.append(group.sort_索引(by='birtions',升序=False)[:1000])
... top1000=pd.concat(件,忽略索引=真)
>>>表=top1000.pivot\u表(行='year',列='sex',aggfunc=总和)
>>>表.地块(标题=‘表1000按年份和性别划分的总和’,
yticks=np.linspace(0,1.2,13),xticks=range(1880,2020,10))
Qt:会话管理错误:不支持指定的任何身份验证协议
我正在运行Kali Linux 1.0.7数据帧看起来很好,我的代码在我尝试绘制它之前运行得很好,所以为什么每次我都会出现错误,我尝试使用pylab.show()函数,但它甚至没有绘制线条?看起来问题出在Qt而不是Matplotlib上。运行qtcreator或类似程序时会发生什么?如果失败,您可能需要重建Qt