Professional Documents
Culture Documents
Untitled
Untitled
ipynb - Colaboratory
import pandas as pd
df = pd.read_csv("/content/Book3.csv")
df
Social
31- Sciences
0 1 M Korea PM 60%~70% NaN
35 and
Humanities
Science
26-
1 2 M China PM and 60%~70% 50%~59%
30
engineering
26-
2 3 M Kenya PM Business 60%~70% NaN
30
21- Law/Legal
3 4 M Vietnam PM 60%~70% 60%~70%
25 studies
21-
4 5 M China PM Business 60%~70% 50%~59%
25
21-
120 121 M China PM Business 60%~70% 50%~59%
25
df.head(5)
df.tail()
df.describe()
Number
count 125.000000
mean 63.000000
std 36.228442
min 1.000000
25% 32.000000
50% 63.000000
75% 94.000000
max 125.000000
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 125 entries, 0 to 124
Data columns (total 9 columns):
https://colab.research.google.com/drive/1Yo23NDblZGNiRaTBLTeB8e150f5vp1JP#scrollTo=k8tmEXThoAiw&printMode=true 1/3
3/23/23, 3:34 PM Untitled10.ipynb - Colaboratory
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Number 125 non-null int64
1 Age 125 non-null object
2 Gender 125 non-null object
3 Nationality 125 non-null object
4 Program 125 non-null object
5 Course 125 non-null object
6 English 119 non-null object
7 Academic 103 non-null object
8 Attendance 119 non-null object
dtypes: int64(1), object(8)
memory usage: 8.9+ KB
df.isnull()
... ... ... ... ... ... ... ... ... ...
120 False False False False False False False False False
121 False False False False False False False False False
122 False False False False False False False False False
123 False False False False False False False False False
124 False False False False False False False False False
df.isnull().sum()
Number 0
Age 0
Gender 0
Nationality 0
Program 0
Course 0
English 6
Academic 22
Attendance 6
dtype: int64
df.dtypes
Number int64
Age object
Gender object
Nationality object
Program object
Course object
English object
Academic object
Attendance object
dtype: object
df.shape
(125, 9)
df.ndim
df['Gender'].replace(['M', 'F'],
[0, 1], inplace=True)
df
https://colab.research.google.com/drive/1Yo23NDblZGNiRaTBLTeB8e150f5vp1JP#scrollTo=k8tmEXThoAiw&printMode=true 2/3
3/23/23, 3:34 PM Untitled10.ipynb - Colaboratory
26-
1 2 0 China PM Science and engineering 60%~70% 50%~59% S3
30
26-
2 3 0 Kenya PM Business 60%~70% NaN S0
30
21-
3 4 0 Vietnam PM Law/Legal studies 60%~70% 60%~70% S0
25
21-
4 5 0 China PM Business 60%~70% 50%~59% S1
25
... ... ... ... ... ... ... ... ... ...
21-
120 121 0 China PM Business 60%~70% 50%~59% S1
25
31-
121 122 1 China PM Business 50%~59% 50%~59% S1
new_df = df.dropna() 35
26
new_df
21-
3 4 0 Vietnam PM Law/Legal studies 60%~70% 60%~70% S0
25
21-
4 5 0 China PM Business 60%~70% 50%~59% S1
25
21-
5 6 0 China PM Law/Legal studies 60%~70% 60%~70% S0
25
21-
6 7 0 China PM Art and Design 60%~70% 60%~70% S0
25
... ... ... ... ... ... ... ... ... ...
21-
120 121 0 China PM Business 60%~70% 50%~59% S1
25
31-
121 122 1 China PM Business 50%~59% 50%~59% S1
35
26
https://colab.research.google.com/drive/1Yo23NDblZGNiRaTBLTeB8e150f5vp1JP#scrollTo=k8tmEXThoAiw&printMode=true 3/3