Skip to content

fix: avoid RuntimeWarning in Intro to Programming Lesson 1 Ex 5 - #491

Open
benluo-maui wants to merge 1 commit into
Kaggle:masterfrom
benluo-maui:fix-intro-programming-ex5-warning
Open

benluo-maui wants to merge 1 commit into
Kaggle:masterfrom
benluo-maui:fix-intro-programming-ex5-warning

Conversation

@benluo-maui

Copy link
Copy Markdown
Contributor

When calculating minors using (titanic_data.Age < 18).sum(), comparing float NaNs against < 18 triggers RuntimeWarning: invalid value encountered in less.

Calling .dropna() before the comparison avoids comparing NaN values, eliminating the warning while preserving the exact output (113).

When calculating minors using (titanic_data.Age < 18).sum(), comparing
float NaNs against < 18 triggers RuntimeWarning: invalid value encountered in less.

Calling .dropna() before the comparison avoids comparing NaN values,
eliminating the warning while preserving the exact output (113).

Bug: http://b/439887971
@benluo-maui

Copy link
Copy Markdown
Contributor Author

@jplotts Please take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant