= pd.read_csv('data/final_contacts.csv').fillna('')
final_contacts = pd.read_csv('data/final_contact_methods.csv').fillna('')
final_contact_methods = pd.read_csv('data/final_gifts.csv').fillna('') final_gifts
Validation
Helpers
missing_no_required_fields
missing_no_required_fields (df:pandas.core.frame.DataFrame, columns:list)
Validate that no required fields are missing in the dataframe
email_is_valid
email_is_valid (s)
Validates an email address.
number_is_valid
number_is_valid (s)
Validates a US phone number.
zip_is_valid
zip_is_valid (p)
Validates a postal code.
Testing Column Names
Contacts Column Names
test_contacts_columns
test_contacts_columns ()
Test that the final_contacts dataframe has the correct columns.
test_contacts_columns()
Gift Column Names
test_gifts_columns
test_gifts_columns ()
Validate the columns of the final gifts dataframe
test_gifts_columns()
Contact Method Column Names
test_contact_method_columns
test_contact_method_columns ()
Validate the columns of the final_contact_methods dataframe
test_contact_method_columns()
Validating Contacts Table
Validating Required Fields Are Not Missing
test_contact_required_fields
test_contact_required_fields ()
Validate that all required fields are present in the final_contacts dataframe.
test_contact_required_fields()
Validating ContactType
test_contacts_contact_type
test_contacts_contact_type ()
Validates that the ContactType column only contains the values ‘Household’ and ‘Organization’
test_contacts_contact_type()
Validating Email
test_contact_email
test_contact_email ()
Validates that all emails are valid
test_contact_email()
Validating Phone Number
test_contact_phone_number_valid
test_contact_phone_number_valid ()
Validate that all phone numbers are valid
test_contact_phone_number_valid()
Validating Postal
test_contact_valid_zip
test_contact_valid_zip ()
Validates that all contacts have a valid zip code
test_contact_valid_zip()
Validating Deceased
test_contact_deceased
test_contact_deceased ()
Validate that all contacts are either deceased or not deceased.
test_contact_deceased()
Validating Gifts
Validating Required Fields Are Not Missing
test_gift_required_fields
test_gift_required_fields ()
Validate that all required fields are present in the gift data.
test_gift_required_fields()
Validating GiftType
test_gift_type
test_gift_type ()
Test that all gift types are valid
test_gift_type()
Validating GiftAmount
test_gift_amount_is_float
test_gift_amount_is_float ()
Test that the GiftAmount column is a float
test_gift_amount_is_float()
Validating CreditCardType
test_credit_card_type
test_credit_card_type ()
Test that all credit card types are valid.
test_credit_card_type()
Validating PledgeId
test_gift_pledge_id
test_gift_pledge_id ()
Test that the number of gifts is equal to the number of unique pledge IDs
test_gift_pledge_id()
Validating ContactMethods
Validating Required Fields Are Not Missing
test_contact_method_required_fields
test_contact_method_required_fields ()
test_contact_method_required_fields()
Validating Type
test_contact_method_type
test_contact_method_type ()
Test that all contact methods are one of the three types
test_contact_method_type()
Export
import nbdev
'04_Test.ipynb') nbdev.nbdev_export(