Kospi_manage.py 387 Bytes
import pandas as pd

source = {
 '학년': [1, 2, 1, 3, 4],
 '성별': ['남자', '여자', '남자', '여자', '남자'],
 '국어': [98, 88, 92, 63, 120],
 '영어': [88, 90, 70, 60, 50],
 '수학': [64, 62, None, 31, None],
 '과학': [None, 72, None, 70, 88]
}
df = pd.DataFrame(source)
df1=df[(df['성별']!='남자')].index
df2=df.drop(df1)
print(df)
print("---------")
print(df2)