About 154,000 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 do I create a "matrix" with a python list? - Stack Overflow

    Aug 12, 2022 · 2 With all below code snippets you can create a 3 * 3 matrix with python: First method: Appending columns inside of loops for each row

  3. matrix - How to make matrices in Python? - Stack Overflow

    Sep 30, 2013 · I've googled it and searched StackOverflow and YouTube.. I just can't get matrices in Python to click in my head. Can someone please help me? I'm just trying to create a basic 5x5 box …

  4. How to create identity matrix with numpy - Stack Overflow

    Jun 7, 2012 · How do I create an identity matrix with numpy? Is there a simpler syntax than numpy.matrix (numpy.identity (n))

  5. python - Creating a Distance Matrix? - Stack Overflow

    Apr 7, 2015 · 2 This is a pure Python and numpy solution for generating a distance matrix. Redundant computations can skipped (since distance is symmetric, distance (a,b) is the same as distance (b,a) …

  6. python - How to write a confusion matrix - Stack Overflow

    May 9, 2020 · Since writing this post, I've updated my library implementation to be a class that uses a confusion matrix representation internally to compute statistics, in addition to pretty printing the …

  7. Simple way to create matrix of random numbers - Stack Overflow

    Apr 30, 2015 · So use it to create a (m,n) matrix and multiply the matrix for the range limit and sum it with the high limit. Analyzing: If zero is generated just the low limit will be held, but if one is generated …

  8. Initializing an n-dimensional matrix elegantly in Python

    Oct 23, 2014 · There have been a couple questions on SO about how to initialize a 2-dimensional matrix, with the answer being something like this: matrix = [[0 for x in range(10)] for x in range(10)] Is …

  9. Create 3D array using Python - Stack Overflow

    May 20, 2012 · I would like to create a 3D array in Python (2.7) to use like this:

  10. How do I create an empty array and then append to it in NumPy?

    I want to create an empty array and append items to it, one at a time. xs = [] for item in data: xs.append(item) Can I use this list-style notation with NumPy arrays?