Answers for "print shape of pandas dataframe"

4

df.shape 0

count_row = df.shape[0]  # gives number of row count
count_col = df.shape[1]  # gives number of col count
Posted by: Guest on May-25-2020
1

pandas shape

>>> df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})
>>> df.shape
(2, 2)
Posted by: Guest on June-14-2020

Python Answers by Framework

Browse Popular Code Answers by Language