Tsallaka zuwa abun ciki
Justice Tech School

Shape, dtypes and info

shape gives rows and columns, dtypes lists column types and describe summarises numbers.

Example
df = pd.DataFrame({"name": ["Ada", "Kofi", "Amina", "Tunde"], "country": ["NG", "GH", "NG", "NG"], "score": [92, 78, 85, 71]})
print(df.shape)
print(df.dtypes)
print(df.describe())

Result

(4, 3)
name         str
country      str
score      int64
dtype: object
           score
count   4.000000
mean   81.500000
std     9.036961
min    71.000000
25%    76.250000
50%    81.500000
75%    86.750000
max    92.000000

Exercise

Rows and columns.

df.

Quiz Test

What does shape return?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.