삭제와 채우기 중 현명하게 선택하기
삭제할 때와 대체할 때를 구분합니다
삭제와 채우기 중 현명하게 선택하기은(는) CoddyKit의 무료 Data Science Academy 강의입니다. 이것은 4개 중 2번째 강의입니다. 아래에서 전체 강의를 무료로 읽을 수 있으며, 내장 코드 에디터와 24/7 AI 튜터와 함께 브라우저에서 직접 실습할 수 있습니다. 이 강의는 Data Science Academy 학습 경로의 일부이며, 진행 상황이 웹과 CoddyKit 앱에 동기화됩니다. Data Science Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
이 강의의 일부는 아직 번역되지 않았으며 영어로 표시됩니다.
Two Roads at a Gap
When you meet missing data, you face one big choice: drop the affected rows, or fill them in. The right road depends on how much you lose either way. 🛣️
Dropping Rows
The method dropna() removes any row that has at least one missing value. It is clean and simple, but it can quietly delete a lot of data.
clean = df.dropna()Dropping Columns Instead
If one column is mostly empty, drop the whole column with axis=1. Sometimes a single bad column hurts more than the rows it sits in.
df.dropna(axis=1)When Dropping Is Safe
Dropping works well when gaps are rare and scattered. Losing a tiny fraction of a large dataset rarely changes your conclusions.
When Dropping Hurts
If many rows share even one gap, dropping can shrink your data drastically. Worse, the rows you lose may not be random, which biases results.
Filling the Gaps
The alternative is to fill missing cells with a sensible value using fillna(). You keep every row, at the cost of inventing some numbers.
df.fillna(0)Filling Is a Guess
Remember that every filled value is an estimate. A good fill is reasonable and documented; a careless one hides the gap and warps your stats.
The thresh Middle Ground
You can keep rows that have enough real data using thresh, which sets the minimum number of non-missing values a row must have to survive.
df.dropna(thresh=3)Target One Column
Use subset to drop rows only when a specific key column is missing. This protects the rest of your data from unnecessary deletion.
df.dropna(subset=['price'])Ask Why It Is Missing
Before deciding, ask why the value is absent. Data missing at random is safe to fill, but a systematic gap may itself be a meaningful signal.
A Simple Rule of Thumb
A handy guide: drop when gaps are few, fill when rows are precious. Always weigh how each choice reshapes your distribution before committing.
Quick Check
A column is 80% empty but every row has useful data elsewhere. What is usually the wisest move?
Recap: Choose With Intent
You now weigh drop versus fill by how much data you lose and why values are missing. Use dropna, thresh, and subset to delete with care.
자주 묻는 질문
“삭제와 채우기 중 현명하게 선택하기” 강의는 무료인가요?
네 — “삭제와 채우기 중 현명하게 선택하기” 전체 내용을 이 웹사이트에서 무료로 읽을 수 있습니다. 인터랙티브하게 실습하려면(내장 코드 에디터와 24/7 AI 튜터), CoddyKit PRO로 업그레이드하면 Data Science Academy 강의 전체를 잠금 해제할 수 있습니다. Data Science Academy 강의에는 총 4개의 강의가 포함되어 있습니다.
“삭제와 채우기 중 현명하게 선택하기”에서 뭘 배우나요?
삭제할 때와 대체할 때를 구분합니다 브라우저에서 직접 실행하는 실습 코드로 Data Science Academy을(를) 배우며, 24/7 AI 튜터가 강의를 진행하면서 질문에 답변해줍니다.
Data Science Academy을(를) 시작하는 데 경험이 필요한가요?
사전 경험은 필요하지 않습니다. CoddyKit의 Data Science Academy은(는) 초급자부터 고급 학습자까지를 위해 구성되어 있으므로, 여기서 시작하거나 처음부터 시작할 수 있으며 자신의 속도대로 진행할 수 있습니다. 이것은 4개 중 2번째 강의입니다.
“삭제와 채우기 중 현명하게 선택하기” 강의는 얼마나 걸리나요?
대부분의 CoddyKit 강의는 약 5~10분이 소요됩니다. 각 강의는 간결하고 인터랙티브하여 꾸준한 진행이 가능하며, 웹과 앱에서 중단한 부분부터 바로 시작할 수 있습니다.
이 Data Science Academy 강의에서 코드를 작성하고 실행할 수 있나요?
네. 모든 Data Science Academy 강의에는 내장 코드 에디터가 포함되어 있으므로, 브라우저에서 바로 실제 코드를 작성하고 실행한 후 즉시 AI 피드백을 받을 수 있습니다 — 로컬 설정이 필요 없습니다.
이 강의의 모든 강의
- 테이블에 숨은 NaNs 찾기
- 삭제와 채우기 중 현명하게 선택하기
- 평균, 중앙값, 최빈값으로 대체하기
- 자료형과 중복 행 수정하기