Answers for "shape in pandas"

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
0

python dataframe shape

print(df.shape)
# (891, 12)

print(df.shape[0])
# 891

print(df.shape[1])
# 12
Posted by: Guest on November-11-2021

Python Answers by Framework

Browse Popular Code Answers by Language