Skip to content

Clean: clean_phone for international prefixes that are not +1 when user select E164 #876

Open
@yixuy

Description

@yixuy

Describe the bug
A clear and concise description of what the bug is.

When the user inputs the E164 as output_format while they are using clean_phone

If some phone number is not in Canada or US(prefix with +1) it will fail

To Reproduce
Steps to reproduce the behavior:

  1. Go to Jupyter notebook
  2. Click on Phone number in the clean module selection
  3. Click on e164 in the selection and select the column(contains phone number) the user would like to clean
  4. Click on the OK
  5. See error

Or:

paste your code here
import pandas as pd
import numpy as np
df = pd.DataFrame({"Name":
                   ["Abby", "Scott", "Scott", "Scott2", np.nan, "NULL"],
                   "AGE":
                   [12, 33, 33, 56,  np.nan, "NULL"],
                   "weight__":
                   [32.5, 47.1, 47.1, 55.2, np.nan, "NULL"],
                   "Admission Date":
                   ["2020-01-01", "2020-01-15", "2020-01-15",
                    "2020-09-01", pd.NaT, "NULL"],
                   "email_address":
                   ["abby@gmail.com","scott@gmail.com", "scott@gmail.com", "test@abc.com", np.nan, "NULL"],
                   "Country of Birth":
                   ["CA","Canada", "Canada", "NULL", np.nan, "NULL"],
                  "Contact (Numbers)":
                   ["1-789-456-0123","1-123-456-7890","1-123-456-7890","86-456-123-7890", np.nan, "NULL" ],

})
df

from dataprep.clean import clean_df_gui
# import matplotlib
# %matplotlib ipympl
clean_df_gui(df)

Expected behavior
A clear and concise description of what you expected to happen.

We expect the 86-456-123-7890 should be +864561237890 after cleaned

Screenshots
If applicable, add screenshots to help explain your problem.
image

Desktop (please complete the following information):

  • OS: [e.g. Windows]
    MacOS 12.3.1
  • Browser [e.g. chrome, safari]
    Safari
  • Platform [Jupyter Notebook, Jupyter Lab, Google Colab, VSCode, Python script]
    Jupyter Notebook
  • Platform Version [e.g. 1.0]
  • Python Version [e.g. 3.7.2]
    3.7.9
  • Dataprep Version [e.g. 0.2.2]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions