Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

number of rows or columns in numpy ndarray python

# get number of rows in 2D numpy array.
numOfRows = np. size(arr2D, 0)
# get number of columns in 2D numpy array.
numOfColumns = np. size(arr2D, 1)
Comment

how to get the number of rows and columns in a numpy array

c = np.array([[1, 2, 3],[6, 5, 4]])

'''
c returns the following matrix
[1, 2, 3]
[4, 5, 6]
'''
print(c.shape)

#returns: (2,3) (number of rows, number of columns)
Comment

PREVIOUS NEXT
Code Example
Python :: numpy randomly swap lines 
Python :: exit a pygame program 
Python :: sum of product 1 codechef solution 
Python :: if equal to key return value python 
Python :: python find if string contains space 
Python :: pandas read csv file 
Python :: reading from a file in python 
Python :: create bootable usb apple 
Python :: HTML template with Django email 
Python :: pyqt5 line edit font size 
Python :: discord.py events 
Python :: python decision tree 
Python :: groupby get last group 
Python :: breadth first search 
Python :: upload_file boto3 headers 
Python :: python3 tuple 
Python :: python regions 
Python :: python form html 
Python :: pandas dataframe convert yes no to 0 1 
Python :: style django forms with crisp 
Python :: How Generate random number in python 
Python :: if key not in dictionary python 
Python :: create new columns pandas from another column 
Python :: python count of values in array 
Python :: how to remove last 2 rows in a dataframe 
Python :: remove a first array of item in python 
Python :: python gitignore 
Python :: flip dictionary python 
Python :: tkinter how to update optionmenu contents 
Python :: python calculated row in dataframe subtract 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =