This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. We're covering it all. You won't want to miss it.
Learn moreLevel up your Power BI skills this month - build one visual each week and tell better stories with data! Get started
I am trying to create a custom Python Power BI Visualization. The actual data is a direct query from a SQL Database.
The fields I want in the visualization are in the Values section of the visualization fields
Here is the what the data table looks like.
| Week | Reading1 | Reading2 | Reading3 | Reading4 | Reading5 |
| 12/20/2019 0:00 | 68.86 | ||||
| 1/6/2020 0:00 | 73.35 | ||||
| 1/13/2020 0:00 | 77.4 | ||||
| 1/20/2020 0:00 | 78.57 | ||||
| 3/2/2020 0:00 | 23.29 | ||||
| 3/9/2020 0:00 | 20.35 | ||||
| 3/16/2020 0:00 | 22.28 | ||||
| 3/23/2020 0:00 | 26.61 | ||||
| 5/11/2020 0:00 | 29.38 | ||||
| 5/18/2020 0:00 | 21.2 | 75.69 | 3.52 | 35.4 | 20.02 |
| 5/25/2020 0:00 | 14.44 | 81.29 | 3.59 | 9.91 | 22.51 |
| 6/1/2020 0:00 | 14.93 | 84.21 | 3.18 | 41.63 | 31.06 |
| 6/8/2020 0:00 | 4.01 | 87.28 | 3.21 | 39.58 | 30.17 |
| 6/15/2020 0:00 | 23.68 | 88.18 | 3.42 | 39.35 | 27.46 |
| 6/22/2020 0:00 | 24.62 | 87.61 | 3.3 | 45.39 | 31.4 |
| 6/29/2020 0:00 | 22.8 | 84.31 | 3.18 | 25.57 | 19.08 |
When I start a custom Python Visualization this is what Power BI generates.
# dataset = pandas.DataFrame(Week, Reading1, Reading2, Reading3, Reading4, Reading5)
If I try the following:
df.DateFrame(Week, Reading1, Reading2, Reading3, Reading4, Reading5)
It throws an error of "name Week is not defined.
df = pandas.DataFrame('Week','Reading1','Reading2','Reading3','Reading4','Reading5')
I get "TypeError: __init__() takes from 1 to 6 positional arguments but 7 were given"
df = pandas.DataFrame("Week","Reading1","Reading2","Reading3","Reading4","Reading5")
I get "TypeError: __init__() takes from 1 to 6 positional arguments but 7 were given"
Any help or guidance would be greatly appreaciated.
Hi @moltra ,
I think maybe you miss the definition of variable. Please reference the document to check it.
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
And for the specific Python script, you could ask for help from the community: https://stackoverflow.com/questions/tagged/python.
Check out the April 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 30 | |
| 24 | |
| 23 | |
| 17 | |
| 15 |
| User | Count |
|---|---|
| 61 | |
| 36 | |
| 29 | |
| 22 | |
| 22 |