About 50 results
Open links in new tab
  1. python - How to define a two-dimensional array? - Stack Overflow

    Jul 12, 2011 · 486 If you really want a matrix, you might be better off using numpy. Matrix operations in numpy most often use an array type with two dimensions. There are many ways to create a new …

  2. How to initialize a two-dimensional array (list of lists, if not using ...

    I'm beginning python and I'm trying to use a two-dimensional list, that I initially fill up with the same variable in every place. I came up with this: def initialize_twodlist(foo): twod_list ...

  3. Two dimensional array in python - Stack Overflow

    91 You do not "declare" arrays or anything else in python. You simply assign to a (new) variable. If you want a multidimensional array, simply add a new array as an array element.

  4. Declaring and populating 2D array in python - Stack Overflow

    Sep 27, 2013 · Declaring and populating 2D array in python Asked 12 years, 4 months ago Modified 7 years, 10 months ago Viewed 43k times

  5. How to access the elements of a 2D array? - Stack Overflow

    I would like to understand how one goes about manipulating the elements of a 2D array. If I have for example:

  6. How to sort 2d array by row in python? - Stack Overflow

    Jan 31, 2010 · I have 2d array, dimension 3x10, and I want to sort by values in 2nd row, from lowest to highest value.

  7. printing a two dimensional array in python - Stack Overflow

    Jul 26, 2013 · I have to print this python code in a 5x5 array the array should look like this : 0 1 4 (infinity) 3 1 0 2 (infinity) 4 4 2 0 1 5 (inf)(inf) 1 0 3 3 4 5 3 0 can anyone help me...

  8. python - How can I make a two-dimensional NumPy array a three ...

    Sep 10, 2011 · I have a two-dimensional array with shape (x, y) which I want to convert to a three-dimensional array with shape (x, y, 1). Is there a nice Pythonic way to do this?

  9. Convert a 1D array to a 2D array in numpy - Stack Overflow

    Sep 25, 2012 · I want to convert a 1-dimensional array into a 2-dimensional array by specifying the number of columns in the 2D array. Something that would work like this: > import numpy as np > A = …

  10. python - quick way to add values to a 2d array - Stack Overflow

    Dec 13, 2013 · Your code fails because [][] this is not how we create 2D lists in python you are incrementing k by 1 where k is a string and that is not allowed in python. You can create two …