Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Seaborn tsplot not showing CI bands

I have a sample dataframe here (it's the pickle for the df). When I do the following:

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

I get the following output (nothing): enter image description here

When I change it to use unit_traces I can actually see the data

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

enter image description here

My question is why can't I see the CI's? The data is a bit disjoint in some places but I would still think it should be able to come up with some sort of confidence band. Am I missing something here?

like image 603
sedavidw Avatar asked Dec 08 '22 04:12

sedavidw


1 Answers

The default estimator (numpy.mean) produces NaNs if there are missing data, which matplotlib simply avoids plotting (often helpful, but here possibly confusing). Using a nan-safe estimator, such as scipy.stats.nanmean should work. Sorry that this is not more obvious in the documentation.

like image 187
mwaskom Avatar answered Dec 11 '22 08:12

mwaskom