양지수

코스피키워드와그래프비교해 양/음수판단

1 +import pandas as pd
2 +
3 +source = {
4 + '학년': [1, 2, 1, 3, 4],
5 + '성별': ['남자', '여자', '남자', '여자', '남자'],
6 + '국어': [98, 88, 92, 63, 120],
7 + '영어': [88, 90, 70, 60, 50],
8 + '수학': [64, 62, None, 31, None],
9 + '과학': [None, 72, None, 70, 88]
10 +}
11 +df = pd.DataFrame(source)
12 +df1=df[(df['성별']!='남자')].index
13 +df2=df.drop(df1)
14 +print(df)
15 +print("---------")
16 +print(df2)
File mode changed
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type
No preview for this file type