Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
I have a simple dataset that looks like this:
year votes 1999 100 2000 150 2001 200
Trying to plot a simple line chart like this:
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot(dataset.year, dataset.votes) ax.set_xlim(1998, 2002) ax.set_ylim(90, 210) plt.show()
Gives me this result (i.e. nothing is plotted but Python/Power BI give me no errors).
Specifying the same data in lists and then plot them like this works:
import matplotlib.pyplot as plt fig, ax = plt.subplots() year_array= [1999,2000,2001] votes_array = [100,150,200] ax.plot(year_array, votes_array) ax.set_xlim(1998, 2002) ax.set_ylim(90, 210) plt.show()
Result:
Am I doing something wrong? The data is formatted as Numbers so the problem is not that. I am using Python 3.6.5 Anaconda distribution and Power BI 2.61.5192.601 64-bit (August 2018) on a Windows 10 machine.
Solved! Go to Solution.
My colleague found what the problem was. The values were summed when dragged in to the value field, i chose "Don't Summarize" and now it works like a charm.
My colleague found what the problem was. The values were summed when dragged in to the value field, i chose "Don't Summarize" and now it works like a charm.
Hi @Anonymous,
Based on my test, When I used the code as below. It worked well as well. Did you add the both columns to the Python visual and enter the code?
import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.plot(dataset.year, dataset.votes) ax.set_xlim(1998, 2002) ax.set_ylim(90, 210) plt.show()
Regards,
Frank
Yes I did, i reckon I would have gotten `KeyError` otherwise and I got no error now. I will try on a collegaues computer and also try uninstalling and installing Power BI otherwise. Python seems to working fine outside of Power BI Python visuals so I assume there is something wrong with Power BI.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 48 | |
| 40 | |
| 37 | |
| 20 | |
| 16 |
| User | Count |
|---|---|
| 69 | |
| 67 | |
| 32 | |
| 27 | |
| 26 |