Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
thmonte
Helper IV
Helper IV

Running Python Script on Dataset

I am connecting to a SQL database that has some GPS data in it.  I want to use this to plot on a map in PowerBI but the data is in State Plane Coordinate System not Lat, Long.  Python has pyproj which will do the conversion for me.  Is there anyway I can run a python function on the SQL table columns and return the result in that table?

 

The python script is very simple - where the x,y values would be the values from two columns in the sql table

 

 

import pyproj

# http://spatialreference.org/ref/epsg/4269/
NAD83 = pyproj.CRS("EPSG:4269")
# http://spatialreference.org/ref/esri/nad-1983-stateplane-new-york-long-island-fips-3104-feet/
NYSP1983 = pyproj.CRS("ESRI:102718")


x, y = (923262, 139019)
result = pyproj.transform(NYSP1983, NAD83, x, y)

print(result)

 

  

Is this possible? Or do I have to do the full conversion in python?

1 REPLY 1
amitchandak
Super User
Super User

@thmonte , refer this. You can run

https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-python-scripts

 

But you have check if this package is supported in power bi - pyproj( If do not need in UI, You should be able to use)

https://powerbi.microsoft.com/en-us/blog/python-visualizations-in-power-bi-service/

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

Check out the April 2026 Power BI update to learn about new features.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.