close

nan值不能直接使用運算式判斷

必須調用library才能判斷是否為nan..

numpy, pandas, math 這三個library可以達成這個目的

code如下

 

import numpy as np
import pandas as pd
import math

n = np.nan
np.nan == np.nan#使用numpy
pd.isnull(np.nan)#使用pandas
math.isnan(np.nan)#使用math

arrow
arrow
    文章標籤
    python numpy nun
    全站熱搜

    低階ㄇㄋ 發表在 痞客邦 留言(0) 人氣()