[Numpy-discussion] ValueError: setting an array element with a sequence.

Lisa Delgado LisaAnnDelgado@gmail....
Tue Sep 16 14:08:55 CDT 2008


Charles R Harris <charlesr.harris <at> gmail.com> writes:

> 
> 
> On Tue, Sep 16, 2008 at 9:05 AM, Lisa Delgado <LisaAnnDelgado <at> gmail.com>
wrote:
> Hi,
> I had previously run a program successfully when using numpy 1.1.0. I just
> downloaded the Enthought Python Distribution, which has numpy 1.0.4 and am now
> having problems running my program. I get the following error.
> Traceback (most recent call last):
>   File "/Users/Lisa/Documents/Dissertation work/PythonPrograms/NashEq.py", line
> 57, in <module>
>     EffortCosts[i,j] = buyeragents[i][j]
> ValueError: setting an array element with a sequence.
> 
> 
> What type is buyeragents? Numpy 1.1.0 fixes a number of bugs in 1.0.4 and you
may have been bitten by that.Chuck 

I found a way to fix my problem. I changed the following code:

for line in binputfile:
    buyeragents.append(line.split())

to:

for line in binputfile:
    buyerdata = map(float, line.split())
    buyeragents.append(buyerdata)

My program is running fine now.

Thanks. Lisa






More information about the Numpy-discussion mailing list