Created
September 2, 2023 22:15
-
-
Save elijahbenizzy/f8cf4ae6f189fdb0a306c3827c2ee51e to your computer and use it in GitHub Desktop.
Feature Engineering -- Common Operations
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
def is_male(gender: pd.Series) -> pd.Series: | |
return gender == "male" | |
def is_female(gender: pd.Series) -> pd.Series: | |
return gender == "female" | |
def is_high_roller(budget: pd.Series) -> pd.Series: | |
return budget > 100 | |
def age_normalized(age: pd.Series, age_mean: float, age_stddev: float) -> pd.Series: | |
return (age - age_mean) / age_stddev | |
def time_since_last_login(execution_time: datetime, last_logged_in: pd.Series) -> pd.Series: | |
return execution_time - last_logged_in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment