-
import seaborn
as sns
-
planets = sns.load_dataset(
'iris')
然后就可以发现iris已经存储了数据了,那么这些数据到底是从哪里来的呢?
我们查看一下load_dataset的docstring:
-
In [
100]: 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
下面就是可以在线或取得数据集啦(可以用来做练习哦)