How to clean data with NumPy: replacing missing values

🔍 Real-world data is messy — and NumPy makes cleaning it easy! Example: Replace missing values with the column mean import numpy as np data = np.array([10, 20, np.nan, 40]) data = np.where(np.isnan(data), np.nanmean(data), data) print(data) Output → [10. 20. 23.333 40.] 💡 NumPy isn’t just math — it’s a data-cleaning superhero. #NumPy #Python #DataCleaning #DataScience #MachineLearning #CodingBlockHisar #Hisar

  • graphical user interface, text, application

To view or add a comment, sign in

Explore content categories