在较旧的项目中,我得到以下结果:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
f, axes = plt.subplots(1, 2, figsize=(15, 5), sharex=True)
sns.distplot(df['Ratio(%)'].dropna(), bins=50, ax=axes[0])
sns.kdeplot(df['Ratio(%)'].dropna(), cumulative=True, ax=axes[1])
plt.show()
该软件的版本如下:
现在,做同样的事情,我得到这个错误:
----> 1 sns.kdeplot(df['Ratio(%)'].dropna(), cumulative=True, ax=axes[1])
ImportError: Cumulative distributions are currently only implemented in statsmodels. Please install statsmodels.
该软件的版本为:
但是,如果我更改代码:
sns.kdeplot(df['Ratio(%)'].dropna(), cumulative=False, ax=axes[1])
它可以工作,但不能达到我期望的图形。