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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. 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/

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.