473,399 Members | 3,302 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

assigning a sequence to an array

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

thanks
Amit

Nov 8 '06 #1
2 2401
am***********@gmail.com 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.

http://www.scipy.org/Mailing_Lists

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

Nov 8 '06 #2
actually what i want to do is this:
i have a file with following format:
1 2
3 9
2 3
4 4

I want to read it and then store the values into two matrices, s.t.
A=[1 2;3 9]
B=[2 3;4 4]

any easier way of doing this?
thanks
Amit

Robert Kern wrote:
am***********@gmail.com 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.

http://www.scipy.org/Mailing_Lists

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
Nov 8 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: vanGogh | last post by:
I have generated classes based on an Xml schema file (xsd) using the XSD.exe tool. My goal is to: - write an application that can parse XML documents - fill objects (based on the generated...
1
by: Jenny | last post by:
Hi, Can I create an array of tags by assigning same name to these tags? For example, I have two <p> tags with the same name t1. But document.all.b.value=document.all.t.length does not...
14
by: Eric Bantock | last post by:
Very basic question I'm afraid. Once an array has been declared, is there a less tedious way of assigning values to its members than the following: myarray=8; myarray=3; myarray=4; myarray=0;...
53
by: Deniz Bahar | last post by:
I know the basic definition of a sequence point (point where all side effects guaranteed to be finished), but I am confused about this statement: "Between the previous and next sequence point an...
8
by: Doug Lerner | last post by:
I have this snippet of client side code running: var makeField = document.forms; alert("makeFieldName name,length,type=" + makeFieldName + ", " + makeField.name + "," + makeField.length + ","...
17
by: I.M. !Knuth | last post by:
Hi. I'm more-or-less a C newbie. I thought I had pointers under control until I started goofing around with this: ...
14
by: pat270881 | last post by:
hello, I have to implement a sequence class, however the header file is predefined class sequence { public: // TYPEDEFS and MEMBER CONSTANTS
1
davydany
by: davydany | last post by:
Hey guys...a n00b Here for this site. I'm making a sequence class for my C++ class. And The thing is in the array that I have, lets say i put in {13,17,38,18}, when i see the current values for the...
37
by: miken32 | last post by:
In PHP, if a function returns an array it's fairly common to capture its return values like this: <?php list($foo, $bar, $baz) = some_function_that_return_an_array(); ?> In Javascript, would...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.