Sección 1. Capítulo 18
single
Challenge: Filling Null Values
Desliza para mostrar el menú
To handle null values while keeping all rows in the DataFrame, use the fillna() method. It allows you to replace each empty cell with a specific value (such as a string or number) instead of removing it.
To replace null values with the number 0, the fillna() method is used:
import pandas as pd
df = pd.read_csv(file.csv)
new_df = df.fillna(0)
Tarea
Swipe to start coding
You are given a DataFrame named wine_data.
- Replace null values with the string
'no'.
Solución
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 18
single
Pregunte a AI
Pregunte a AI
Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla