找出 Null 值
在上一個練習中,你已經觀察到兩種 NULL 資料型別 None 與 numpy 的非數值物件 np.nan 在算術與邏輯運算中的行為差異。這個練習中,你將透過比較這兩種類型,進一步理解它們的行為。numpy 套件已經以 np 匯入。
本練習屬於課程
在 Python 中處理遺漏值
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
try:
# Print the comparison of two 'None's
print("'None' comparison output: ", ___)
except TypeError:
# Print if error
print("'None' does not support this operation!!")