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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

Import multiple dataframes from Python script

Hi Everyone,

 

I want to use python script which generates multiple dataframes. 

I wanted to know that how can populate/import these multiple tables in PowerBI? 

 

Note: I can not merge these tables. 

 

For Example:

 

 

 

 

 

import pandas as pd
df1 = pd.DataFrame({'Name':['A']*1000, 'Value': range(1000)})
df2 = pd.DataFrame({'Name':['B']*2500, 'Value': range(2500)})
df3 = pd.DataFrame({'Name':['C']*3000, 'Value': range(3000)})

 

 

 

 

 

 

Thank you for helping me out. 

Regards

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

A limitation of visuals (core, custom, R, Python or otherwise) is that they can only execute a single DAX query , and therefore only contain a single dataset, so it is not possible to use two independent data frames. The only way around this might be to to combine all the data as a single dataset and then process into independent data frames accordingly before you start doing your main body of work.

The boilerplate code is a series of comments informing you what pre-processing Power BI does to the dataset prior to the point where you add your code, as well as how to access the visual data (i.e. though the named dataset variable). If this were missing and you had not read the relevant documentation then it might not be clear how to proceed withough seeking information elsewhere. It's basically a succinct version of this section of the doc:

As you select or remove fields, supporting code in the Python script editor is automatically generated or removed.

Based on your selections, the Python script editor generates the following binding code.

  • The editor created a dataset dataframe, with the fields you added.
  • The default aggregation is: do not summarize.
  • Similar to table visuals, fields are grouped and duplicate rows appear only once.

Regards,

Jay

View solution in original post

1 REPLY 1
Anonymous
Not applicable

Hi @Anonymous ,

 

A limitation of visuals (core, custom, R, Python or otherwise) is that they can only execute a single DAX query , and therefore only contain a single dataset, so it is not possible to use two independent data frames. The only way around this might be to to combine all the data as a single dataset and then process into independent data frames accordingly before you start doing your main body of work.

The boilerplate code is a series of comments informing you what pre-processing Power BI does to the dataset prior to the point where you add your code, as well as how to access the visual data (i.e. though the named dataset variable). If this were missing and you had not read the relevant documentation then it might not be clear how to proceed withough seeking information elsewhere. It's basically a succinct version of this section of the doc:

As you select or remove fields, supporting code in the Python script editor is automatically generated or removed.

Based on your selections, the Python script editor generates the following binding code.

  • The editor created a dataset dataframe, with the fields you added.
  • The default aggregation is: do not summarize.
  • Similar to table visuals, fields are grouped and duplicate rows appear only once.

Regards,

Jay

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.