Seaborn: BUG: Regplot with lists: "TypeError: only integer arrays with one element can be converted to an index"

Created on 10 Dec 2013  路  7Comments  路  Source: mwaskom/seaborn

Awesome lib, thanks!

The following sequence of commands results in a Traceback (from moss) and
also a figure.

import seaborn as sns
x, y = range(100), range(100)
sns.regplot(x, y)

Traceback::

<matplotlib.figure.Figure object at 0xbdb0b6c>
Traceback (most recent call last):

File "<ipython-input-4-48c88ed4333f>", line 1, in <module>
    sns.regplot(x, y)

File ".../seaborn/plotobjs.py", line 742, in regplot
    boots = moss.bootstrap(x, y, func=_bootstrap_reg)

File ".../lib/python2.7/site-packages/moss/statistical.py", line 61, in bootstrap
    sample = [a[resampler] for a in args]

TypeError: only integer arrays with one element can be converted to an index

A comparable pandas DataFrame approach doesn't raise any errors:

import seaborn as sns
import pandas as pd
df = pd.DataFrame({'one':range(100), 'two':range(100)})
sns.regplot('one', 'two', df)

Versions:

seaborn -- seaborn/master
husl -- pypi latest
moss -- pypi latest
bug

Most helpful comment

Yes it looks like this was re-introduced at some point.

It's probably a good idea to support lists, since matplotlib does and they only need a simple conversion, but to be fair the docs do say:

x, y: string, series, or vector array

All 7 comments

Thanks, should be fixed in master. In the meantime you should be able to convert the lists to arrays.

Thanks!

same bug for jointplot

I'm seeing the same thing as @vtphan.

I get the same problem as @westurner westurner and the only solution is to convert the list to arrays
import seaborn as sns x, y = range(100), range(100) sns.regplot(x, y)
Can any one else try the same ? Is it possible to reopen the issue

Yes it looks like this was re-introduced at some point.

It's probably a good idea to support lists, since matplotlib does and they only need a simple conversion, but to be fair the docs do say:

x, y: string, series, or vector array

Thanks!

Was this page helpful?
0 / 5 - 0 ratings