- Daily Dose of Data Science
- Posts
- Beware of This Unexpected Behaviour of NumPy Methods
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.
π Join today: https://huggingface.co/spaces/competitions/movie-genre-prediction.
Letβs get to todayβs post now!

If a NumPy array contains NaNs, NumPy's aggregate functions (np.mean, np.min, np.max, etc.) return NaN.
But this may not be desired at times.
One solution is to replace the NaN entries with a default value (0).
However, NumPy also provides nan-insensitive methods, such as np.nansum, np.nanmin, etc.
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?
π 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.
Reply