MulaiMulai sekarang secara gratis

Null value operations

While working with missing data, you'll have to store these missing values as an empty type. This way, you will easily be able to identify them, replace them or play with them! This is why we have the None and numpy.nan types. You need to be able to differentiate clearly between the two types.

In this exercise, you will compare the differences between the behavior of None and numpy.nan types on application of arithmetic and logical operations.numpy has already been imported as np. The try and except blocks have been used to avoid errors.

Latihan ini adalah bagian dari kursus

Dealing with Missing Data in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

try:
  # Print the sum of two None's
  print("Add operation output of 'None': ", ___)

except TypeError:
  # Print if error
  print("'None' does not support Arithmetic Operations!!")
Edit dan Jalankan Kode