| | |
numpy array rows and columns
Thread Solved |
0
#2 18 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; 18 Days Ago at 7:05 pm.
May 'the Google' be with you!
•
•
Join Date: Nov 2009
Posts: 2
Reputation:
Solved Threads: 0
0
#3 18 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; 18 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 accessdenied anti apache application approximation argv array beginner book builtin calculator change converter countpasswordentry curved dan08 dictionaries dictionary dynamic edit enter examples file float format function gui heads homework import inches input java keyboard lapse launcher library line lines linux list lists loop microphone mouse movingimageswithpygame mysqlquery newb number numbers numeric output parameters parsing path phonebook plugin port prime programming projects py2exe pygame pyopengl python random recursion redirect remote reverse scrolledtext session simple software sprite statictext string strings syntax table terminal text textarea thread threading time tlapse trick tuple tutorial twoup ubuntu unicode unit urllib urllib2 variable wordgame wxpython






