python库之seaborn库


一、seaborn

1.简介

seaborn是matplotlib的延伸和扩展,如果你知道matplotlib,你就已经掌握了Seaborn的大部分。

seaborn特别地以数据可视化为目标。

用matplotlib最大的困难是其默认的各种参数,而seaborn则完全避免了这一问题。

2.as

import seaborn as sns

3.网址

http://seaborn.pydata.org/examples/index.html

http://seaborn.pydata.org/api.html

二、加载数据

1.自己的数据

加载Pandas DataFrame。

2.Seaborn 的示例数据集(snsn.load_dataset())

2018年09月08日 13:33:16 傻了吧嗒 阅读数:2408

相信大家在学习GroupBy,或者数据透视表时,都有可能会碰到类似下面的一行代码:

import seaborn as sns



planets = sns.load_dataset('planets')

然后就可以发现planets已经存储了数据了,那么这些数据到底是从哪里来的呢?

我们查看一下load_dataset的docstring:

In [54]: sns.load_dataset??



Signature: sns.load_dataset(name, cache=True, data_home=None, **kws)



Source:



def load_dataset(name, cache=True, data_home=None, **kws):



    """Load a dataset from the online repository (requires internet).







    Parameters



    ----------



    name : str



        Name of the dataset (`name`.csv on



        https://github.com/mwaskom/seaborn-data).  You can obtain list of



        available datasets using :func:`get_dataset_names`



    cache : boolean, optional



        If True, then cache data locally and use the cache on subsequent calls



    data_home : string, optional



        The directory in which to cache data. By default, uses ~/seaborn-data/



    kws : dict, optional



        Passed to pandas.read_csv







    """

可以看到docstring的第一行就说明了这个函数是从在线存储库加载数据集的(需要互联网)。

网址:https://github.com/mwaskom/seaborn-data

sns.heatmap()

square=Ture,强制方块,但数据过长会挤在一起

square=False,自动更具数据长度调整的矩形,不会挤在一起


参考:

https://www.jianshu.com/p/5ff47c7d0cc9

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值