0
add_suburb値に基づいてcountyカラムの欠損値を記入しようとしています。私はカラムが空でないか空でない場合にのみ記入してください。
for index, row in fileco.iterrows():
df.loc[df['add_suburb'].str.contains(str(row['place'])) & (df['county'].str=='') , 'county'] = str('County '+row['county']).title()
for index, row in fileco.iterrows():
df.loc[df['add_suburb'].str.contains(str(row['place'])) & (df['county'].str is None) , 'county'] = str('County '+row['county']).title()
機能しない、次の2つのコードを試してみましたが、私はNoneまたは==「」をチェックしていない場合は、次のコードは動作します。
for index, row in fileco.iterrows():
df.loc[df['add_suburb'].str.contains(str(row['place'])) , 'county'] = str('County '+row['county']).title()
欠落している列の値のみを入力する正しい方法は何ですか? &の後の状態をどのように修正する必要がありますか?