"Pandas 특정컬럼이 결측치인 행 제거"의 두 판 사이의 차이

(새 문서: ==개요== ;Pandas 특정컬럼이 결측치인 행 제거 <syntaxhighlight lang='python' notebook> import numpy as np import pandas as pd df = pd.DataFrame({"name": ['Alfred', 'Bat...)
 
8번째 줄: 8번째 줄:
df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
                   "toy": [np.nan, 'Batmobile', 'Bullwhip'],
                   "toy": [np.nan, 'Batmobile', 'Bullwhip'],
                   "born": [pd.NaT, pd.Timestamp("1940-04-25"),
                   "born": [pd.NaT, pd.Timestamp("1940-04-25"), pd.NaT]})
                            pd.NaT]})
df
df
</syntaxhighlight>
</syntaxhighlight>

2021년 8월 1일 (일) 17:14 판

1 개요

Pandas 특정컬럼이 결측치인 행 제거
import numpy as np
import pandas as pd

df = pd.DataFrame({"name": ['Alfred', 'Batman', 'Catwoman'],
                   "toy": [np.nan, 'Batmobile', 'Bullwhip'],
                   "born": [pd.NaT, pd.Timestamp("1940-04-25"), pd.NaT]})
df
df.dropna(subset=['toy'])

2 같이 보기

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}