Don't miss your chance to take the Fabric Data Engineer (DP-700) exam on us!
Learn moreWe've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now
Following instructions from here https://docs.microsoft.com/en-us/power-bi/desktop-python-scripts
I can run the following python code and generate data.
import pandas as pd data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=['Name','Age'],dtype=float)
print (df)
I contructed same df in a class - created a package named Mypackage
import pandas as pd
class Mydata:
def __init__(self):
pass
def main_page(self):
data = [['Alex',10],['Bob',12],['Clarke',13]]
df = pd.DataFrame(data,columns=['Name','Age'],dtype=float)
return df
Now when I call the data, nothing is returned
from Mypackage import MyData
df = Mydata().main_page()
print(df)
If I try
from Mypackage import MyData
df = Mydata().main_page()
print(df.head())
Then I get the following error
Unable to connect
Details: "ADO.NET: Python script error.
Traceback (most recent call last):
File "PythonScriptWrapper.PY", line 13, in <module>
print(df.head())
AttributeError: 'NoneType' object has no attribute 'head'
"
Solved! Go to Solution.
Hi @vasimnps ,
What the version of Python do you install? If you use 3.7, please install Python 3.6 to have a try. And make sure you have installed Pandas package.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @vasimnps ,
What the version of Python do you install? If you use 3.7, please install Python 3.6 to have a try. And make sure you have installed Pandas package.
Best Regards,
Xue Ding
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
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.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 55 | |
| 40 | |
| 35 | |
| 19 | |
| 18 |
| User | Count |
|---|---|
| 71 | |
| 70 | |
| 38 | |
| 35 | |
| 23 |