#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'})
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter