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!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I'm trying to plot a dataframe as a matplotlib table in a Python visual. I tested the code in Jupyter, and it works fine, but the same code in PowerBI gives a KeyError. The error seems to be coming from this part of the script:
the_table = plt.table(cellText=common_df,
colColours=ccolors,
colLabels=column_headers,
loc='center')
This exact same code works fine with a simpler dataframe, but when I plug in my actual one, I get a KeyError: 0. Any ideas on why this might be happening, especially given that it works fine in Jupyter?
@Penguin236 , very difficult to tell with this info.
But in power bi you have to drag column on python visual and you can only use those
Check my video on how I created those visual
https://www.youtube.com/watch?v=rX3-G8u5fwc
can you share the python script including comments in power bi
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 56 | |
| 53 | |
| 40 | |
| 17 | |
| 16 |
| User | Count |
|---|---|
| 122 | |
| 108 | |
| 44 | |
| 32 | |
| 26 |