Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hi,
I have a table in power bi loaded by sql server. I would like to use the table TIMPI in a python script in "Query Editor". How can I do it?
The script python that I would use is below. How can I use the object
import pandas as pd
from datetime import datetime
df_tim = TIMPBI[temperature>90]
now = datetime.strftime(
datetime.now(),
"%Y-%m-%dT%H:%M:%S"
)
df = pd.DataFrame(columns=('id_device', 'datetime','temperature'))
for i in range(0,len(df_tim),1):
df.loc[i] = [df_tim.iloc[i,0], now, df_tim.iloc[i,1]]
print (df)
Hi @henryco88 ,
Please refer to this post: Power BI: How to use Python with multiple tables in the Power Query Editor?
Best Regards,
Icey
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Have you installed Python that Power BI Supports? Take a look at this article from MS that will walk you through the process.
Once you've done that, you simply use the Get Data command and select Python Script.
If you've done all of that and still have issues, please post back with specific issues.
DAX is for Analysis. Power Query is for Data Modeling
Proud to be a Super User!
MCSA: BI ReportingI am running my script in get data but it does not recognize the TIMPBI table.
Hi @edhans ,
I know how to run a python script in Power BI 🙂 My problem is that I would like to use TIMPBI table (loaded earlier, see screenshot above) in my python code. How can I do it?
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 19 | |
| 10 | |
| 9 | |
| 7 | |
| 6 |