Semantic Link Functions for Geopandas

0.14.0 · active · verified Wed Apr 15

Semantic link functions for Geopandas enables conversion of a FabricDataFrame to a GeoDataFrame. This package is part of the broader Microsoft Fabric Semantic Link ecosystem, which facilitates connecting Power BI datasets with Synapse Data Science. It is actively maintained, with new versions often released in conjunction with other `semantic-link` packages.

Warnings

Install

Imports

Quickstart

Creates a sample FabricDataFrame with latitude and longitude, then converts it into a GeoDataFrame using the `to_geopandas` semantic function. This demonstrates the core functionality of mapping semantic columns to a geospatial object.

import pandas as pd
from sempy.fabric import FabricDataFrame

# Example FabricDataFrame (usually obtained from a Power BI dataset in Fabric)
df = FabricDataFrame(
    {
        "country": ["US", "AT"],
        "lat": [40.7128, 47.8095],
        "long": [-74.0060, 13.0550]
    },
    column_metadata={
        "lat": {"data_category": "Latitude"},
        "long": {"data_category": "Longitude"}
    },
    pd_dataframe=pd.DataFrame()
)

# Convert to GeoDataFrame
df_geo = df.to_geopandas(lat_col="lat", long_col="long")

print(df_geo.head())
print(df_geo.geometry.name)

view raw JSON →