BUG: Regplot with lists: "TypeError: only integer arrays with one element can be converted to an index"
See original GitHub issueAwesome 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
Issue Analytics
- State:
- Created 10 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
only integer arrays with one element can be converted to an ...
The issue is just as the error indicates, time_list is a normal python list, and hence you cannot index it using another list...
Read more >only integer scalar arrays can be converted to a scalar index
Error encountered is: "TypeError: only integer scalar arrays can be converted to a scalar index". This error comes when we handle Numpy array...
Read more >only integer scalar arrays can be converted to a scalar index
Solution: To solve this error you need to convert array 1 and array 2 in to tuple or list. Kindly see the following...
Read more >TypeError only integer scalar arrays can be converted to a ...
This is the error: TypeError: only integer scalar arrays can be converted to a scalar index with 1D numpy indices array.
Read more >Data structures accepted by seaborn - PyData |
The advantage of long-form data is that it lends itself well to this explicit specification of the plot. It can accommodate datasets of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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:
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