Data scientist
Senior
technical
Suppose you have a time series dataset with temperature readings collected every hour. Explain how you would handle missing data points using Pandas, discussing not only the techniques you would use but also the implications of those choices.
def handle_missing_temperatures(df):
# Option 1: Forward fill to propagate the last valid observation
df['temperature'] = df['temperature'].fillna(method='ffill')
# Option 2: Interpolation for a more accurate trend
# df['temperature'] = df['temperature'].interpolate(method='linear')
return df
Trusted by 100+ professionals preparing for interviews
Trusted by 100+ professionals
50+ Company Question Banks
5+ Supported Languages
Practice More Questions Like This
Generate unlimited interview questions with structured answers, code runner, and AI-powered walkthroughs.
Get Started Free