473,584 Members | 2,874 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two-dimensional array tutorial?

Hi!

I'd like to handle two-dimensional arrays. My first choice, the numpy
library, doesn't seem to be an option due to compatibility issues (see
my other thread about python22.dll).

Is there a tutorial somewhere how to handle 2d-arrays with vanilla Python?

Thanks and best regards,
Martin
Oct 22 '08 #1
5 6297
Martin Schneider wrote:
Hi!

I'd like to handle two-dimensional arrays. My first choice, the numpy
library, doesn't seem to be an option due to compatibility issues (see
my other thread about python22.dll).

Is there a tutorial somewhere how to handle 2d-arrays with vanilla Python?
there isn't much to them, simply create an use:

foo = [[0 for _ in xrange(height)] for _ in xrange(width)]

or something similar. Then you just use

foo[x][y]

to access individual elements.

Alternatively, you can use the module "array" for the inner list to be more
memory-efficient.

Obviously you don't get any further operations on arrays such as
transposition, multiplication and the like.

Can't you just get Numpy (or it's predecessors, Numeric) compiled against
ptyhon2.2?

Diez
Oct 22 '08 #2
Diez B. Roggisch schrieb:
Can't you just get Numpy (or it's predecessors, Numeric) compiled against
ptyhon2.2?
I tried Numeric, but e.g. it doesn't seem to feature transpose...

How do I compile Numpy against python2.2? :-)

Thanks for your answers and best regards,
Martin
Oct 22 '08 #3
Martin Schneider wrote:
Diez B. Roggisch schrieb:
>Can't you just get Numpy (or it's predecessors, Numeric) compiled against
ptyhon2.2?

I tried Numeric, but e.g. it doesn't seem to feature transpose...

How do I compile Numpy against python2.2? :-)

By following the instructions on their website? I don't know Windows, and I
don't know if Numpy is even released for python2.2, as that is ancient. If
not, you're pretty much out of luck.

Diez
Oct 22 '08 #4
Martin Schneider wrote:
Diez B. Roggisch schrieb:
>Can't you just get Numpy (or it's predecessors, Numeric) compiled against
ptyhon2.2?

I tried Numeric, but e.g. it doesn't seem to feature transpose...
Yes, it does. Numeric.transpo se()
How do I compile Numpy against python2.2? :-)
You cannot. The first version of numpy required Python >= 2.3.

--
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

Oct 22 '08 #5
Robert Kern schrieb:
Martin Schneider wrote:
>I tried Numeric, but e.g. it doesn't seem to feature transpose...

Yes, it does. Numeric.transpo se()
Then I must have made a mistake. I'll look into it. Thanks for the
correction.
>How do I compile Numpy against python2.2? :-)

You cannot. The first version of numpy required Python >= 2.3.
Yeah, I read in your other post, which crossed mine. Sh*t :-)

Thanks and best regards,
Martin
Oct 22 '08 #6

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

Similar topics

7
1582
by: Jamey Cribbs | last post by:
At the risk of calling my manhood into question, I humbly submit the following little diddy (which is a blatant rip-off of a heart wrenching melody of the '70s by that international superstar, Mary Macgregor): To the tune of "Torn Between Two Lovers": Torn between two languages, both of which are awesome tools Lovin' both of you is...
0
1777
by: SimonC | last post by:
I'm looking to do something similar to a feature found on Ticketmaster.com, where you select your seats at a venue, and then you have two minutes in which to take or leave them. QUESTION 1a. Inside (or just after) the same query that searches for available seats, I need to SIMULTANEOUSLY mark those seats as "on hold". I've only read...
8
1740
by: John Grenier | last post by:
Hi, I have to determine the "standing" (WIN - TIE - LOSS) from confrontations between two teams on a contest. The table matchResults has fields cont_id, team_id and contest_result (int). TABLE matchResults cont_id team_id contest_result 1 1 3 1 2 5
6
1864
by: Willem | last post by:
Hi, I have a newbie question: is it possible to make a search form in asp that searches in two different databases (access)? Willem
10
9334
by: Hank1234 | last post by:
Can I use one Data Adapter and one Command Builder to update amny tables? Currently in my data adapter I query two tables and fill them into two tables in a data set. When I make a change to a record in the second table and call the update method of the data adapter the command builders update command text is for the first table. Can the...
6
4069
by: Matt K. | last post by:
Hi there, I have a form in an Access project that contains a subform which displays the results of a query of the style "select * from where = #a certain date#". In the main part of the form the user can change the date, which will force a requery in the subform to bring up records from the date selected. My question is this... The...
5
12980
by: Jamie Pittman via AccessMonster.com | last post by:
I have two tables with 5000 entries on them. One is based for regular time with several variables example (employee name, date,time in and out, code, customer, building) I have another table that works with overtime but has the same feilds within the table. I want to be able to run a report that combines the regular time and overtime for the...
15
2707
by: Hi5 | last post by:
Hi, I am designing a database for a client in which It has a client table including the followings: 1-Table Client 2-Table lookupcategory 3-Table Ctegory
7
12874
by: Prabhudhas Peter | last post by:
I have two object instances of a same class... and i assigned values in both object instances (or the values can be taken from databse and assigned to the members of the objects)... Now i want to compare these two objects so that it will return true if both object's members have the same value... it is good if u can give me a single function...
0
7897
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8189
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8330
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7940
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6587
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3824
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3850
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2336
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1438
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.