1. 程式人生 > >pandas中基本操作——如缺失值處理。等

pandas中基本操作——如缺失值處理。等

 # =====替換缺失值===
data[data.isnull()] = 0 
data.fillna(0,inplace=True)


#====25%  和75%===
sta = data['A_sale'].describe()      #.describe()中有基本的資料,自己可以列印試試
stb = data['B_sale'].describe()
#print(sta)
'''
count     30.000000
mean     430.618559
std      278.629712
min       26.157783
25%      213.463059
50%      403.759538
75%      599.212448
max      972.841767
Name: A_sale, dtype: float64
'''
a_iqr = sta.loc['75%'] - sta.loc['25%']
b_iqr = stb.loc['75%'] - stb.loc['25%']