473,386 Members | 1,693 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,386 software developers and data experts.

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 6283
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.transpose()
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.transpose()
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
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...
0
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....
8
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). ...
6
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
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...
6
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...
5
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...
15
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
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
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
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

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.