包含标签 seaborn 的文章

K-Means聚类及sklearn实现

聚类分析允许我们找到相似样本或者feature的组,这些对象之间的相关性更强。 常见的用途有包括按照不同的基因表达情况对样本进行分组,或者根据不同样本的分类对基因进行分组等……

阅读全文

Seaborn绘制核密度曲线实例详解

在频率分布直方图中,当样本容量充分放大到极限时,组距极限缩短,这个时候频率直方图中的阶梯折线就会演变成一条光滑的曲线,这条曲线就称为总体的密度分布曲线。

这篇文章春江暮客将详细介绍如何使用python绘图库seaborn和panda里面的iris也就是鸢尾花卉数据集来绘制各种炫酷的密度曲线。

……

阅读全文

TypeError: ufunc 'isnan' not supported for the input types解决办法

今天在使用python的seaborn画热图(clustermap)的时候,发现了总是出现这个错误,而且可以知道自己的数据完全是符合条件的,在搜索了谷歌后也没有找到好的解决方法,经过摸索后这里把最终解决方法告诉大家。

1.生成dataframe

    import pandas as pd
    import numpy as np
    import matplotlib.pyplot as plt
    from seaborn import clustermap
    import seaborn as sns; sns.set(color_codes=True)
    df = pd.DataFrame([["a","b","c","d","e","f"],[1,2,3,4,5,6],[2,3,4,5,6,7],[3,4,5,6,7,8]],  columns=list('ABCDEF')).T
    df
    g = sns.clustermap(df.iloc[:,1:],cmap="PiYG")

生成dataframe并转置后,出现类型错误,TypeError: ufunc ‘isnan’ not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ”safe”

……

阅读全文

seaborn画小提琴图(violin plot)

简介

小提琴图是用来展示多组数据的分布状态以及概率密度。跟箱线图类似,但是可以密度层面展示更好。在数据量非常大不方便一个一个展示的时候小提琴图特别适用。而python里面的seaborn包可以很方便的画出小提琴图。

参数

《seaborn画小提琴图(violin plot)》

小提琴图各位置对应参数,中间一条就是箱线图数据,25%,50%,75%位置,细线区间为95%置信区间。

……

阅读全文