{"id":6452,"library":"semantic-link-functions-phonenumbers","title":"Semantic Link Functions for Phone Numbers","description":"This library integrates the `phonenumbers` package with Semantic Link, enabling validation and enrichment of phone numbers within Microsoft Fabric DataFrames (FabricDataFrames). It simplifies operations on phone number columns for data quality and analysis, adding columns indicating validity, type, and various formats. The current version is 0.14.0, and it appears to follow the active release cadence of the broader `semantic-link-functions` project.","status":"active","version":"0.14.0","language":"en","source_language":"en","source_url":"https://github.com/microsoft/semantic-link-functions","tags":["semantic-link","microsoft-fabric","phonenumbers","data-validation","etl","data-quality"],"install":[{"cmd":"pip install semantic-link-functions-phonenumbers","lang":"bash","label":"Install core package"},{"cmd":"pip install phonenumbers sempy","lang":"bash","label":"Install required dependencies"}],"dependencies":[{"reason":"Provides the core phone number parsing and validation logic (PyPI: google-i18n-phonenumbers).","package":"phonenumbers","optional":false},{"reason":"Required for FabricDataFrame integration and related Semantic Link functionalities within Microsoft Fabric.","package":"sempy","optional":false},{"reason":"Underlying DataFrame operations, implicitly required by sempy and FabricDataFrame.","package":"pandas","optional":false}],"imports":[{"symbol":"validate_phone_number","correct":"from semantic_link_functions_phonenumbers import validate_phone_number"}],"quickstart":{"code":"import pandas as pd\nfrom sempy.fabric import FabricDataFrame # sempy is a required dependency for FabricDataFrame\nfrom semantic_link_functions_phonenumbers import validate_phone_number\n\n# In a real Microsoft Fabric environment, a FabricDataFrame \n# would typically be loaded from a Lakehouse table or similar source.\n# For demonstration, we create one from a pandas DataFrame.\ndata = {'phone': ['+12065550100', '123-456-7890', 'invalid phone number']}\ndf = FabricDataFrame(pd.DataFrame(data))\n\n# Validate phone numbers in the 'phone' column\n# The function adds new columns (e.g., '_is_valid', '_number_type', '_e164_format')\ndf_validated = validate_phone_number(df, 'phone')\n\nprint(\"Original DataFrame:\\n\", df)\nprint(\"\\nValidated DataFrame (selected columns):\\n\")\nprint(df_validated[['phone', 'phone_is_valid', 'phone_number_type', 'phone_e164_format']].head())\n\n# Example of filtering invalid numbers\n# print(df_validated[~df_validated['phone_is_valid']])","lang":"python","description":"This quickstart demonstrates how to initialize a `FabricDataFrame` and use `validate_phone_number` to process a column containing phone numbers. The function enriches the DataFrame by adding several new columns with validation results and formatted phone numbers, such as `phone_is_valid` and `phone_e164_format`."},"warnings":[{"fix":"Ensure `pip install semantic-link-functions-phonenumbers phonenumbers sempy` is run to cover all dependencies.","message":"This library has peer dependencies on `phonenumbers` (PyPI: `google-i18n-phonenumbers`) and `sempy` which must be installed separately. Failing to install them will result in runtime `ModuleNotFoundError` or similar issues.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `sempy.fabric.FabricDataFrame` for optimal compatibility and feature utilization, especially in a Microsoft Fabric environment.","message":"The library is primarily designed for use with `FabricDataFrame` within Microsoft Fabric. While it might accept `pandas.DataFrame` in some contexts, full integration, expected performance, and access to Fabric-specific features are achieved when working with `sempy.fabric.FabricDataFrame`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Review the function signature and explicitly pass `country_code`, `region_code`, or `strict=True` to tailor the validation logic to your specific needs.","message":"The `validate_phone_number` function offers optional parameters like `country_code`, `region_code`, and `strict`. The default validation behavior might not align with specific regional or strictness requirements without explicit configuration, potentially leading to unexpected validation results.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}