Seaborn tsplot 未显示 CI 条带

Seaborn tsplot not showing CI bands

我有一个示例数据框 here(它是 df 的 pickle)。当我执行以下操作时:

df = pd.read_pickle('test.pickle')
sns.tsplot(data=df.sort('time', ascending=True), time='time', unit='entity', condition='prior_type', value='perf')

我得到以下输出(无):

当我将其更改为使用 unit_traces 时,我实际上可以看到数据

sns.tsplot(data=df.sort('time', ascending=True), time='time', unit='entity', condition='prior_type', value='perf', err_style='unit_traces')

我的问题是为什么我看不到 CI 的?数据在某些地方有点脱节,但我仍然认为它应该能够得出某种置信区间。我在这里遗漏了什么吗?

如果缺少数据,默认估计器 (numpy.mean) 会生成 NaN,而 matplotlib 只是避免绘图(通常有用,但在这里可能会造成混淆)。使用 nan-safe 估计器,例如 scipy.stats.nanmean 应该可以。抱歉,这在文档中不是很明显。

scipy.stats.nanmean 从 scipy 0.15.0 开始弃用,取而代之的是 numpy.nanmean。在 scipy 0.15.0 documentation.

中阅读更多内容