Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot call stripplot, boxplot, or violinplot #532

Closed
joshmaxsilverman opened this issue Apr 30, 2015 · 3 comments
Closed

cannot call stripplot, boxplot, or violinplot #532

joshmaxsilverman opened this issue Apr 30, 2015 · 3 comments

Comments

@joshmaxsilverman
Copy link

I'm unable to call stripplot, boxplot, or violinplot. A use case:

> sns.boxplot(x='dev_from_overall', y='vessel', data=df)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-30-02db1e3dae3b> in <module>()
----> 1 sns.boxplot(x='dev_from_overall', y='vessel', data=df)

TypeError: boxplot() takes at least 1 argument (0 given)

On the other hand, stripplot isn't even found:

> import seaborn as sns
> sns.set_style("whitegrid")
> tips = sns.load_dataset("tips")
> ax = sns.stripplot(x=tips["total_bill"])
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-31-a7d56fd8964f> in <module>()
      2 sns.set_style("whitegrid")
      3 tips = sns.load_dataset("tips")
----> 4 ax = sns.stripplot(x=tips["total_bill"])

AttributeError: 'module' object has no attribute 'stripplot'

I'm on 0.5.1, any ideas?

@mwaskom
Copy link
Owner

mwaskom commented Apr 30, 2015

The API of boxplot and violinplot has changed since 0.5.1 was released, and stripplot was added. See this pull request for details.

@joshmaxsilverman
Copy link
Author

I've switched to the dev-channel and tried to issue this from the docs

import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
sns.boxplot("day", "total_bill", data=tips)

and get the following error, which I also get with my own data.

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-66-5852717fecb6> in <module>()
      2 sns.set_style("whitegrid")
      3 tips = sns.load_dataset("tips")
----> 4 sns.boxplot("day", "total_bill", data=tips)

/Users/fherngulley/anaconda/lib/python2.7/site-packages/seaborn/distributions.pyc in boxplot(vals, groupby, names, join_rm, order, color, alpha, fliersize, linewidth, widths, saturation, label, ax, **kwargs)
    182     # Calculate the KDE
    183     if _has_statsmodels:
--> 184         # Prefer using statsmodels for kernel flexibility
    185         x, y = _statsmodels_univariate_kde(data, kernel, bw,
    186                                            gridsize, cut, clip,

/Users/fherngulley/anaconda/lib/python2.7/site-packages/seaborn/distributions.pyc in _box_reshape(vals, groupby, names, order)
     98         kde_kws = dict()
     99     if rug_kws is None:
--> 100         rug_kws = dict()
    101     if fit_kws is None:
    102         fit_kws = dict()

/Users/fherngulley/anaconda/lib/python2.7/site-packages/numpy/core/numeric.pyc in asarray(a, dtype, order)
    460 
    461     """
--> 462     return array(a, dtype, copy=False, order=order)
    463 
    464 def asanyarray(a, dtype=None, order=None):

ValueError: could not convert string to float: day

@mwaskom
Copy link
Owner

mwaskom commented Apr 30, 2015

Since the stacktrace is referencing seaborn/distributions.py i'm guess the upgrade didn't fully work somehow, since boxplot currently lives in seaborn/categorical.py.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants