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 :: pandas split train test 
Python :: create dataframe with column names pandas 
Python :: place a widget in a specific position in tkinter 
Python :: how to return only fractional part in python 
Python :: how to set screen brightness automatically depending on battery percentage using python 
Python :: python twilio certificate error 
Python :: pandas forward fill after upsampling 
Python :: image bad when scaled in pygame 
Python :: raatatatatatatatatatatatatatatatatatatatatatatatatatatattatana 
Python :: pil save image 
Python :: program to split the list between even and odd python 
Python :: skewness python 
Python :: upload multiple files streamlit 
Python :: python date now plus days 
Python :: convert categorical variable to numeric python 
Python :: take multiple string as int in a list python 
Python :: array comparison in percent 
Python :: numpy series reset index 
Python :: factors addition in pyhone 
Python :: simple gui for pygame 
Python :: python hex to bytes string 
Python :: python check if character before character in alphabet 
Python :: # list all keywords in Python 
Python :: python open dicom 
Python :: get dictionary in array python by value 
Python :: install scratchattach 
Python :: tqdm in python 
Python :: django template iterate dict 
Python :: python teilen ohne rest 
Python :: list to string python 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =