The goal of this JustPython is to give you some concrete examples for getting started with pandas.

Table of Contents

1. df.head(n)

➤ Purpose: Summarizes your DataFrame—columns, data types, and missing values.

In [4]: df.head()

__________________________________________________________________________________________________
out [4]: 
	Name	                  Age	  Sex
0	Braund, Mr. Owen Harris	22.0	male
1	Allen, Mr. William He..	35.0	male
2	Bonnell, Miss. Elizab..	58.0	female
3	Cumings, Mrs. John B...	38.0	female
4	Heikkinen, Miss. Laina	26.0	female

In [5]: df.head(2)

__________________________________________________________________________________________________
out [5]: 
	Name	                  Age	  Sex
0	Braund, Mr. Owen Harris	22.0	male
1	Allen, Mr. William He..	35.0	male

2. df.info()

➤ Purpose: Summarizes your DataFrame—columns, data types, and missing values.

In [5]: df.info()

__________________________________________________________________________________________________
out [5]: 

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 9 entries, 0 to 8
Data columns (total 3 columns):
 #   Column  Non-Null Count  Dtype  
---  ------  --------------  -----  
 0   Name    9 non-null      object 
 1   Age     8 non-null      float64
 2   Sex     9 non-null      object 
dtypes: float64(1), object(2)
memory usage: 348.0+ bytes

3. df.describe()

➤ Purpose: Provides summary statistics for all numeric columns.

In [6]: df.describe()

__________________________________________________________________________________________________
out [6]: 

			Age
count	8.000000
mean	34.000000
std	  17.328754
min	  4.000000
25%	  25.000000
50%	  35.000000
75%	  42.000000
max	  58.000000