2021-09-14 無名関数(lambda) python 機械学習 df_sex = df["sex"].apply(lambda x: 1 if x=="Male" else 0) applyを通じて渡されたGenderをxとして、xがMaleなら1、Maleではないなら0を返すという意味。