seaborn

Seaborn数据可视化入门

假装没事ソ 提交于 2020-11-01 20:02:28
在本节学习中,我们使用Seaborn作为数据可视化的入门工具 Seaborn的官方网址如下:http://seaborn.pydata.org 一:definition Seaborn is a Python data visualization library based on matplotlib . It provides a high-level interface for drawing attractive and informative statistical graphics. Seaborn是基于matplotlib的数据可视化库,它的主要功能是做数据可视化 二:Setup the notebook 对数据进行初始化,引入相应的包 import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns pirnt("Setup Complete") 三: Load the data 加载数据 file_path = "../input/fifa.csv" fifa_data = pd.read_csv(file_path, index_col="Date", parse_Dates=True) 注: file_path: 表示dataset的路径

Python 机器学习:多元线性回归

痴心易碎 提交于 2020-10-29 04:53:46
向AI转型的程序员都关注了这个号 👇👇👇 大数据挖掘DT机器学习 公众号: datayx 接着上一次的一元线性回归 python机器学习:线性回归 往下讲,这篇文章要讲解的多元线性回归。 1、什么是多元线性回归模型? 当 y 值的影响因素 不 唯一时, 采 用多元线性回归模型 。 例如商品的销售额可能不电视广告投入,收音机广告投入,报纸广告投入有关系,可以有 sales = β0+ β 1*TV+ β 2* radio+ β 3*newspaper. 2、使用pandas来读取数据 pandas 是一个用于数据探索、数据分析和数据处理的python库 import pandas as pd # read csv file directly from a URL and save the results data = pd .read_csv('/home/lulei/Advertising.csv') # display the first 5 rows data.head() 这里的Advertising.csv是来自http://www-bcf.usc.edu/~gareth/ISL/Advertising.csv。大家可以自己下载。 上面代码的运行结果: TV Radio Newspaper Sales 0 230.1 37.8 69.2 22.1 1 44.5 39.3

Seaborn入门系列(四)——stripplot和swarmplot

半世苍凉 提交于 2020-10-27 16:56:09
Seaborn入门系列(四)——stripplot和swarmplot Seaborn是基于matplotlib的Python可视化库。 它提供了一个高级界面来绘制有吸引力的统计图形。Seaborn其实是在matplotlib的基础上进行了更高级的API封装,从而使得作图更加容易,不需要经过大量的调整就能使你的图变得精致。但应强调的是,应该把Seaborn视为matplotlib的补充,而不是替代物。 注:所有代码均在IPython notebook中实现 stripplot(分布散点图) 先总览一下stripplot的API: seaborn.stripplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, jitter=False, dodge=False, orient=None, color=None, palette=None, size=5, edgecolor='gray', linewidth=0, ax=None, **kwargs) 接下来就直接上代码演示,首先导入相应的包,这个大家应该都很熟悉了。 1import seaborn as sns 2%matplotlib inline 3sns.set(font_scale=1.5,style="white") 4sns.set