Matplotlib-利用pandas进行数据分析并作可视化展示

一、简单的绘图展示二、绘制柱状图三、共用坐标轴绘制两种不同类型的图四、pandas导入excel数据并绘制频率分布直方图五、绘制箱线图一、简单的绘图展示randomList = np.random.randn(10).cumsum()randomList#结果''' array([ 0.43692622, -0.17404988, 0.847985...
摘要由CSDN通过智能技术生成


一、简单的绘图展示

randomList = np.random.randn(10).cumsum()
randomList

#结果
'''
    array([ 0.43692622, -0.17404988,  0.8479853 ,  1.39711286,  1.67546532,
            4.37286221,  4.22259538,  4.40355887,  4.38907365,  4.45077964])
'''
s = pd.Series(randomList,
              index=np.arange(0,100,10))# index 指定序列中每个元素的索引
s




#结果
'''
    0     0.436926
    10   -0.174050
    20    0.847985
    30    1.397113
    40    1.675465
    50    4.372862
    60    4.222595
    70    4.403559
    80    4.389074
    90    4.450780
    dtype: float64
'''
s.plot()  #用pandas中的Seris绘制折线图
plt.show()

这里写图片描述

#利用pandas的DataFrame绘图
arr = np.random.randn(10,4)  #产生一组10行4列的随机数组
arr



#结果

    array([[ 0.01616026,  0.57473119,  0.65414164,  0.93159686],
           [-0.03817341, -0.64962119,  0.27062599,  1.87690331],
           [ 1.15445861,  0.26759284,  0.69272073, -1.03753846],
           [ 0.11747495,  0.07197997,  0.15004073, -1.42265905],
           [-1.03527018,  0.38356526, -0.60570823,  0.45902491],
           [ 1.00210782, -1.18924028, -1.15890713,  0.7904771 ],
           [-0.70293899,  
  • 5
    点赞
  • 13
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值