This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import perfplot | |
def numpy_where(df): | |
return df.assign(is_rich=np.where(df['salary'] >= 50, 'yes', 'no')) | |
def list_comp(df): | |
return df.assign(is_rich=['yes' if x >= 50 else 'no' for x in df['salary']]) | |
def loc(df): |