Created
December 1, 2019 22:34
-
-
Save cordon-thiago/cc62f28916b158c934132be99068c1f2 to your computer and use it in GitHub Desktop.
Create variables percNumbersInEmailUser, hasNumberInEmailUser and emailUserCharQty
This file contains hidden or 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 libraries | |
import pandas as pd | |
import numpy as np | |
from functions import aux_functions | |
# Calculate character qty in e-mail user | |
hardbounce_2['emailUserCharQty'] = hardbounce_2['email'].apply(lambda x : len(aux_functions.getEmailUser(x))) |
This file contains hidden or 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 libraries | |
import pandas as pd | |
import numpy as np | |
from functions import aux_functions | |
# Compute percentage of numbers in username | |
hardbounce_2['percNumbersInEmailUser'] = hardbounce['email'].apply(aux_functions.getEmailUser).apply(aux_functions.percentageNumberInStr) | |
# Create dummy indicating if username has numbers | |
hardbounce_2['hasNumberInEmailUser'] = hardbounce_2['percNumbersInEmailUser'].apply(lambda x : 1 if x > 0 else 0) | |
aux_functions.freqTable( | |
[hardbounce_2["hasNumberInEmailUser"]] | |
,[hardbounce_2["flgHardBounce_n"]] | |
,True | |
,"index" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment