양지수

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

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)
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