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

Power BI Python query

Hi guys,

Having trouble to find a solution for this. When run a Python query in my normal IDE i get the proper result:

Well Name              |   Phase    |       Value   | 

UNIVERSITY 20 PW 2502H |    INT     |       52.75    
TIGER 55-2-12 LOV 8H | MNH | 58.25
UNIVERSITY 20 TG UNIT | SRF | 25.50

but in PBI i am getting just:

 

52.75

58.25

25.50 

Without the index in my first picture. using the following code, do you know how i can get my normal answer with all index?

 

condition1 = df[df['Actual Operation']=='DRL']
condition1=pd.DataFrame(condition1.groupby(by=['Well Name', 'Phase'])['Sum of Activity Time (Hr)'].sum())
condition1=condition1[condition1.isin(condition1.groupby(['Phase']).min()['Sum of Activity Time (Hr)'].tolist())].dropna()

 

Thanks

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

If you modify the last line like below, will the output be a table, not just a column?

condition1=condition1.isin(condition1.groupby(['Phase']).min()['Sum of Activity Time (Hr)'].tolist())

If this issue persists, please share sample data and complete python code.

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@Anonymous ,

 

If you modify the last line like below, will the output be a table, not just a column?

condition1=condition1.isin(condition1.groupby(['Phase']).min()['Sum of Activity Time (Hr)'].tolist())

If this issue persists, please share sample data and complete python code.

 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.