Skip to content

Instantly share code, notes, and snippets.

@cordon-thiago
Created December 1, 2019 22:34
Show Gist options
  • Save cordon-thiago/cc62f28916b158c934132be99068c1f2 to your computer and use it in GitHub Desktop.
Save cordon-thiago/cc62f28916b158c934132be99068c1f2 to your computer and use it in GitHub Desktop.
Create variables percNumbersInEmailUser, hasNumberInEmailUser and emailUserCharQty
# 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)))
# 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