df.shape[0] code example
Example 1: df.shape 0
count_row = df.shape[0] # gives number of row count
count_col = df.shape[1] # gives number of col count
Example 2: pandas shape
>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.shape
(2, 2)
Example 3: .shape[0] python
In [46]: Y = np.arange(12).reshape(3,4)
In [47]: Y
Out[47]:
array([[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]])
In [48]: Y.shape
Out[48]: (3, 4)
In [49]: Y.shape[0]
Out[49]: 3