Discover more from Daily Dose of Data Science
Beware of This Unexpected Behaviour of NumPy Methods
...and here's how to counter it.
🍿 Movie Genre Prediction Competition 🍿
Data-Driven Science launched a new competition on Hugging Face: The Movie Genre Prediction Competition 🎥
The objective of this competition is to design a predictive model that accurately classifies movies into their respective genres based on their titles and synopses.
Participants will be provided with a comprehensive dataset comprising ~100,000 movies, and the primary evaluation metric will be accuracy.
The submission deadline is July 31st, 2023.
Let’s get to today’s post now!
If a NumPy array contains NaNs, NumPy's aggregate functions (
np.max, etc.) return
But this may not be desired at times.
One solution is to replace the NaN entries with a default value (
However, NumPy also provides nan-insensitive methods, such as
As a result, the output isn't influenced by the presence of NaNs.
👉 Over to you: What are some other unexpected behaviors of NumPy that you are aware of?
Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day. Also, get a Free Data Science PDF (350+ pages) with 250+ tips.
👉 Tell the world what makes this newsletter special for you by leaving a review here :)
👉 If you liked this post, don’t forget to leave a like ❤️. It helps more people discover this newsletter on Substack and tells me that you appreciate reading these daily insights. The button is located towards the bottom of this email.
👉 If you love reading this newsletter, feel free to share it with friends!
👉 Sponsor the Daily Dose of Data Science Newsletter. More info here: Sponsorship details.
Find the code for my tips here: GitHub.