2017-02-09 52 views
0

我做的有2場 插座型的基本數據探索:如何找到NaN的有條件熊貓

array(['Supermarket Type1', 'Grocery Store', 'Supermarket Type3', 
     'Supermarket Type2'], dtype=object) 

Outlet_Size:

array(['Medium', nan, 'Small', 'High'], dtype=object) 

我已經找到了一些見解如下: 如果Outlet_Type是雜貨店,它總是一個小的Outlet_Size。

我想使用這些信息來填充Outlet_size中的一些Nan,其中Outlet_type =雜貨店。

有人可以幫助我,如果條件在菲爾納?

+0

歡迎來到StackOverflow。請花時間閱讀這篇文章[如何提供一個偉大的熊貓示例](http://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples)以及如何提供[最小,完整和可驗證的示例](http://stackoverflow.com/help/mcve)並相應地修改您的問題。 [如何提出一個好問題](http://stackoverflow.com/help/how-to-ask)上的這些技巧也可能有用。 – jezrael

回答

0
df.iloc[np.where(df.Outlet_type == 'Grocery Store'), 'Outlet_Size'] = 'Small'