| | |
numpy array rows and columns
Thread Solved |
0
#2 17 Days Ago
Use numpy shape ...
Python Syntax (Toggle Plain Text)
import numpy as np # create a 3 by 5 array of integer zeroes z = np.zeros([3, 5], int) print( z ) """ [[0 0 0 0 0] [0 0 0 0 0] [0 0 0 0 0]] """ # check the shape print( "shape --> %d rows x %d columns" % z.shape ) """ [[0 0 0 0 0] [0 0 0 0 0] [0 0 0 0 0]] shape --> 3 rows x 5 columns """
Last edited by vegaseat; 17 Days Ago at 7:05 pm.
May 'the Google' be with you!
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
0
#3 17 Days Ago
I found out from a friend.
Thanks for your input anyway!
Python Syntax (Toggle Plain Text)
x = array.shape[0] # sets x as the number of rows y = array.shape[1] # sets y as the number of columns
Last edited by Chromana; 17 Days Ago at 7:54 pm.
![]() |
Similar Threads
- Search Array (C++)
- How to convert rows into columns (MySQL)
- convert rows to columns (VB.NET)
- table rows and columns (PHP)
- inputing a text file into an array (C++)
- Problem with multiDimensional array? (C)
- Two-dimensional char array (C++)
- assign elements to a multi-d array (C)
- constructor with an array as an argument (C++)
Other Threads in the Python Forum
- Previous Thread: Drawing Circles?
- Next Thread: Help with my Blackjack Program
| Thread Tools | Search this Thread |
abrupt ansi anti apache approximation array assignment avogadro backend beginner binary bluetooth book builtin calculator character code converter countpasswordentry curved customdialog dan08 dictionaries dictionary dynamic examples exe file float format function gnu graphics gui heads homework ideas import inches input java launcher library line lines linux list lists loop mouse mysqlquery number numbers numeric output parsing path phonebook plugin pointer port prime programming progressbar projects py2exe pygame python random recursion redirect scrolledtext software statictext statistics string strings sum table terminal text textarea thread threading time tlapse trick tricks tuple tutorial twoup ubuntu unicode urllib urllib2 variable wordgame write wxpython xlib






