BaşlayınÜcretsiz Başlayın

Missing values

It is very rare to find a dataset that doesn't contain any missing values. Missing values are represented as NaN in pandas. You can use the isnull() pandas function to check for missing values. pd.isnull(df['column']) will return True if the value is missing, or False if there are no missing values.

Compared to R, missing values behave a little differently in Python. For example, the .mean() method automatically ignores missing values in Python. You can also recode missing values with the .fillna() method. This will replace all missing values in the column with the provided value.

In this exercise, we've modified the tips dataset such that it contains some missing values.

Bu egzersiz

Python for R Users

kursunun bir parçasıdır
Kursu Görüntüle

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Print the rows where total_bill is missing
print(tips.loc[____(____)])
Kodu Düzenle ve Çalıştır