Wed Nov 06 2024 18:59:54 GMT+0000 (Coordinated Universal Time)
Saved by @signup_returns
#Missing values import pandas as pd data = { 'Name': ['John', 'Alice', 'Steve'], 'Age': [18, None, 20], 'City': ['New York', 'California', None] } df = pd.DataFrame(data) df.fillna({'Age': df['Age'].mean(), 'City': 'Unknown'})
Copy this HTML code:
Preview:
open_in_newInstructions on embedding in Medium
Comments