FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]` instead of `arr[seq]`

scipy
nontuple
seaborn futurewarning
pymc3 using a non tuple sequence for multidimensional indexing is deprecated
upgrade scipy
seaborn distplot fit
python suppress futurewarning
specifying number of bins with seaborn

I would like not to use the non-tuple sequence for multidimensional indexing so that the script will support future release of Python when this changes.

Below is the code that i am using for plotting the graph:

data = np.genfromtxt(Example.csv,delimiter=',', dtype=None, names=True, 
    converters={0: str2date})

p1, = host.plot(data["column_1"], data["column_2"], "b-", label="column_2")
p2, = par1.plot(data["column_1"], data['column_3'], "r-", label="column_3")
p3, = par2.plot(data["column_1"], data["column_4"], "g-", label="column_4")

host.set_xlim([data["column_1"][0], data["column_1"][-1]])
host.set_ylim(data["column_2"].min(), data["column_2"].max())
par1.set_ylim(data["column_3"].min(), data["column_3"].max())
par2.set_ylim(data["column_4"].min(), data["column_4"].max())

I can reproduce the warning with:

In [313]: x = np.zeros((4,2))
In [315]: x[:,1]
Out[315]: array([0., 0., 0., 0.])

By replacing the : with a slice(None) we can write this indexing as:

In [316]: x[[slice(None),1]]
/usr/local/bin/ipython3:1: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.
  #!/usr/bin/python3
Out[316]: array([0., 0., 0., 0.])

It really should be a tuple, rather than a list:

In [317]: x[(slice(None),1)]
Out[317]: array([0., 0., 0., 0.])
In [318]: x[tuple([slice(None),1])]
Out[318]: array([0., 0., 0., 0.])

The warning tells us that the list format used to be ok, but will in the future produce an error.

I don't see anything your code that does this sort of slice in a list indexing.

data from genfromtxt is a structured array, so indexing by field name is normal: data["column_1"]. So it's likely that the warning is generated within the plot code. But we don't have any clue as to where. The warning doesn't give any sort of error stack trace, do it?

So without a sample array like data, or a csv file like Example.csv, we can't reproduce the warning, and dig further.


For a start I'd put some sort of print between each of your code lines. The goal is to pin down which matplotlib call is producing the warning.

If for example it is produced in

host.set_xlim([data["column_1"][0], data["column_1"][-1]])

I might try changing that call to

host.set_xlim((data["column_1"][0], data["column_1"][-1]))

or

host.set_xlim(data["column_1"][0], data["column_1"][-1])

That's a bit of wild guess...

edit

FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]`

This latest SO, helps us identify a problem function in the scipy.stats package. It constructs a list of slices, and uses it without further conversion to tuple.

Suggestion in warning message about non-tuple indexing could be , Right now non-tuple indexing raises a new FutureWarning: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either

Upadating Scipy fixed this problem in my case. Cause the Scipy.stats class was deprecated.

Using a non-tuple sequence for multidimensional indexing , It's just a deprecation warning, but it should be use to fix it sequence for multidimensional indexing is deprecated; use `arr[tuple(seq indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an  FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]` instead of `arr[seq]` 1 get view of numpy array using boolean or sequence object (advanced indexing)

I would have tested this before posting (well, I did test it for areas where I was having the same problem), but I suspect that this will help you. Using your first line where you call a plot above, use tuple type casting as I've shown and do the same to your other lines calling plot.

p1, = host.plot(tuple(data["column_1"]), 
                tuple(data["column_2"]), 
                "b-", label="column_2")

When I studied numpy methods of indexing, the warning made a little more sense. However, I don't really understand why things need to go this way.

Jupyter Notebook error when graphing with Seaborn, FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq] . In the future  FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated use `arr[tuple(seq)]` (4 answers) Closed last year . I have this warning that shows up whenever I try to use distplot from seaborn , and I can't seem to figure out what I'm doing wrong, sorry if it's simple.

Plotting with Seaborn, FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be  Hi. In traing i have this warning: F:\Python\lib\site-packages\theano\tensor\signal\pool.py:574: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`.

Multidimensional indexing - Questions, FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq] . In the future this will be  FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use arr[tuple(seq)] instead of arr[seq]. I would welcome any suggestions regarding how to address this. Copy link Quote reply

FutureWarning: Using a non-tuple sequence for , compute_mutation_probabilities.py:46: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of  I'm actually surprised at the number of backward-incompatible changes Numpy is making these days! There has been quite a bit of discussion on that for each case, but, yes, it is true, mostly because there are now a couple of developers who have started to go through and clean up

Comments
  • I suspect the offending code is in matplotlib. Is your version up to date?
  • @AndrasDeak yes, i have updaed version.
  • You can probably turn the warning into an error using the first two lines of this answer (I haven't used it ever myself). That might tell you which module and code line the error is coming from.
  • Actually, here "data" is a numpy array. and "data["column_1"]" is a non tuple sequence. I am not facing this warning with numpy==1.14.5. The problem is in updated versions of numpy. Is there a way i can convert this to "arr[tuple(seq)]" ?
  • No, the problem is not the updated version of numpy. The warning is new in numpy and signals a future deprecation, so you need to fix everything else.
  • The sad thing is really that users expect the libraries to work out of the box, but when it comes to identifying potential problems (e.g. by providing reproducible examples) any request for those is ignored.
  • @ImportanceOfBeingErnest reproducible examples are often hard to construct, especially when a lot of users are working with proprietary data, under time pressure. Sometimes it's easier (or appears easier) to shrug and either ignore it or figure out a workaround.