Filling Missing Values
Replace missing values with meaningful data using fillna() and other methods.
Fill with a Constant
Replace all NaN with a single value:
Loading Pandas Playground...
Fill with Column-Specific Values
Use a dictionary for different fill values:
Loading Pandas Playground...
Fill with Statistics
Use mean, median, or mode:
Loading Pandas Playground...
Forward and Backward Fill
Propagate previous or next values:
Loading Pandas Playground...
Interpolation
Fill based on surrounding values:
Loading Pandas Playground...
Limiting Fill
Limit how many consecutive NaN to fill:
Loading Pandas Playground...
Exercise: Fill with Mean
Loading Exercise...
Exercise: Forward Fill
Loading Exercise...
Key Points
fillna(value)replaces NaN with constant- Use dict for column-specific fill values
- Fill with statistics:
fillna(df['col'].mean()) ffill()propagates last valid value forwardbfill()propagates next valid value backwardinterpolate()fills based on surrounding valueslimit=restricts consecutive fills
التالي · الدرس 26 من 42
Dropping Missing Values
قراءة 1 دقيقة
أنهيت 25 من 42 درسًا

اسأل Byte عن هذا الدرس
محادثة خاصة حول هذا الدرس. قرأ Byte الدرس كاملًا، ويجيب خلال ثوانٍ، ويُظهر القسم الذي تأتي منه كل إجابة. يمكنك السؤال بأي لغة.
الأسئلة والأجوبة
أسئلة عامة حول هذا الدرس. يجيب AI Tutor فورًا بلغتك، ويراجع فريق FreeAcademy الإجابات، ويمكن لكل المتعلمين قراءتها.

