Back to Community
Upgrading seaborn library in Research environment

I was confused when the functionality of some seaborn plotting functions in the Research environment was inconsistent with the online documentation - it looks like there was a major release (v6.0) this past June with many API changes, while Quantopian appears to be using an older version.

Are there plans to upgrade the seaborn plotting library version imported in the Research environment? I realize it might require some code changes to the advanced plotting tutorial (and users' preexisting notebooks), but it would nice to be able to take advantage of the very good online docs for v6.0 and not be confused by the different API.

Thanks!

4 responses

The research environment is running seaborn version 0.6.0, which is the latest release. What kind of issues is your code running into?

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

I was interested in making violin plots showing distribution of fundamentals according to industry, but I ran into unexpected syntax errors when calling sns.violinplot(). Something like this works on a local ipython notebook running seaborn 0.6.0, but not in the research environment:

import pandas as pd  
import seaborn as sns  
%matplotlib inline

df = pd.DataFrame({  
        'some_fundamental':np.random.randn(20),  
        'industry_code':np.random.randint(1,4,20)}  
    )  
sns.violinplot(x='industry_code',y='some_fundamental',data=df)  

I pulled up the docstring/signature in the research environment (?sns.violinplot) and get something like:
Signature: sns.violinplot(vals, groupby=None, inner='box', color=None, positions=None, names=None, order=None, bw='scott', widths=0.8, alpha=None, saturation=0.7, join_rm=False, gridsize=100, cut=3, inner_kws=None, ax=None, vert=True, **kwargs)

This looked a little different from what I get using my local notebook:
Signature: sns.violinplot(x=None, y=None, hue=None, data=None, order=None, hue_order=None, bw='scott', cut=2, scale='area', scale_hue=True, gridsize=100, width=0.8, inner='box', split=False, orient=None, linewidth=None, color=None, palette=None, saturation=0.75, ax=None, **kwargs)

which is why I was wondering if the seaborn version in the research envionment was up to date.

Looks like its been updated now - Thanks!!

Another issue - sns.stripplot() raises an RestrictedAttributeError when called. Some sample code:

import pandas as pd  
import seaborn as sns  
import numpy as np

df = pd.DataFrame({  
        'some_fundamental':np.random.randn(20),  
        'industry_code':np.random.randint(1,4,20)}  
    )  
# sns.violinplot(x='industry_code',y='some_fundamental',data=df)  
sns.stripplot(x='industry_code',y='some_fundamental',data=df)  

Does sns.stripplot need to be whitelisted or something?