assigning a sequence to an array

Robert Kern robert.kern at
Wed Nov 8 09:04:48 CET 2006

amitsoni.1984 at wrote:
> Hi,
> I am using  "A[a,:]=row" in python, where A is a matrix and row is a
> sequence. But it gives following error:
> -------- error------
>     A[a,:]=row
> ValueError: setting an array element with a sequence.
> Is there a way to change type of sequence to array so that this
> situation could be handled

You don't say what array package you are using. I presume numpy. In any case,
the place to ask those questions (even for the older numarray and Numeric
packages) is the numpy list.

We will need some more information from you when you come to the numpy list.
Please reduce your problematic code to the smallest, self-contained script that
demonstrates the problem, and post it and the exact output that you get.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the Python-list mailing list