# 2D « array « Python Data Type Q&A

Home
Python Data Type Q&A
 1 array 2 date 3 dictionary 4 Format 5 integer 6 List 7 numpy 8 regex 9 string 10 tuple
 Python Data Type Q&A » array » 2D

### 1. Determining three in a row in Python 2d array    stackoverflow.com

I'm working on a tic-tac-toe game with a M x N board in Python. I'm trying to find an efficient way to determine if a player has won (3 in ...

### 2. create 2d array in python?    stackoverflow.com

this is the code i am trying to create the 2d matrix

``````m=4
tagProb=[[]]*(m+1)
count=0
index=0
for line in lines:
print(line)
if(count < m+1):
...``````

### 3. Python cumulative histogram of 2D array    stackoverflow.com

I have the following problem. I have a 2D array of N pairs. e.g: x = [[5,2],[10,5],[3,2],...] (so a set of arrays a = [5,10,3,...] and b= [2,5,2,...] The first column (a) corresponds ...

### 4. Python 2D Array access with Points (x,y)    stackoverflow.com

Good Evening mates, I'm new to python programming, and I was just wondering if you can access a 2D array in python using Points/Coordinate? Example you have a point: point = (1,2) and you have ...

### 5. how to access elements in a 2D array?    stackoverflow.com

I am new to python and I would like to understand how one goes about manipulating the elements of an array. If I have for example:

``a= ( a11 a12 a13 )  ...``

### 6. how to output 2D array to file in python    stackoverflow.com

I am very new to Python and trying to learn some basic python tricks for my optical modelling tool. The modelling software I am using has a python wrapper, thus everything ...

### 7. 2d array import from file    dreamincode.net

2d array import from file Posted 07 December 2010 - 02:41 AM I'm trying to import a set of data from a file. All the data is 2 digits, and it's a neatly organized 9x10 array. Here's the data: 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 ...

### 8. i need help in 2d array !    dreamincode.net

Hello everyone ! I have difficulties with python.I hope I'm going to learn fast : ) my question is how to do 2D array in python ? I knew that it's in java as that a[][]=newdouble[n][m] but I don't know what is it in python ? from pylab import* x_start = -200 x_end = 200 y_start = -100 y_end = 100 ...

### 9. Python 2D array    dreamincode.net

Hey, this code is to output an array of numbers from a text file, and also the totals and averages of each of the columns. I have it so far that it outputs the array along with the totals and averages of the rows, and the totals for the columns. I am having trouble outputting the averages for the columns however. ...

### 10. 2d array slow!    python-forum.org

2d array slow! by vish Sat May 23, 2009 11:53 am Hi All, I wrote this piece of code to calculate the pair-wise affinity between all the objects in a list, and store it in a 2d-array. I am using the numpy module for the array operations. After storing the affinities into the 2d array, I process the array by ...

### 12. Confused with 2D array    python-forum.org

Code: Select all def create_table(m, n): matrix = [[1]*(m) for x in range(n)] return matrix def fill_table(m, n, table): pom = [] pom.extend(table) print(pom is table) ...

### 13. Quick way to create -huge- 2d array?    python-forum.org

Hello! I'm writing a program that calculates uni- and bigram probabilities for NLP. Even if you don't know what this is, I have a simple question: For this work I need a huge 2d array, where the size of each dimension is the number of different words in the corpus. Currently this means I have to make a 16544x16544 array. For ...

### 15. Building a 2D array    python-forum.org

Building a 2D array by WaynaPicchu Sun Feb 21, 2010 3:02 am Background: I'm ultimately trying to build a 20x20 2D array of integers by importing a file containing twenty lines each with a string of 40 digits, converting each block of two characters in each string into an integer, and assigning that integer to location grid[i][j]. For the purposes ...

### 16. Question on how to set up something similar to a 2d array.    python-forum.org

From what I've read online I understand you cannot make 2d arrays in python.Basically I'm making a game with a leader board function and I need an array to hold the player's name, and current position. So basically I'd have player1 at position1, player2 at position2, and so forth, then sort it by the position to have the leader on top, ...

### 17. 2D array problem - Solved!    python-forum.org

ROWS = 10 COLS = 20 def empty_grid(): return [['?' for y in xrange(COLS)] for x in xrange(ROWS)] def print_grid(grid): for row in grid: print ''.join(str(item) for item in row) grid = empty_grid() print_grid(grid)