Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi, I was giong through the documentation on setting up the python integration for Power BI, found here:
Using Python in Power BI Power Query Editor - Power BI | Microsoft Docs
But when I try and run the given python script in step 6, I get this error:
DataSource.Error: ADO.NET: Python script error.
<pi> File "C:\Users\dsalmons\PythonScriptWrapper_6c538dbf-144d-4194-a3ea-46c5f0684a3f\PythonScriptWrapper.PY", line 17
import pandas as pd
IndentationError: unexpected indent
</pi>
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
<pi> File "C:\Users\dsalmons\PythonScriptWrapper_6c538dbf-144d-4194-a3ea-46c5f0684a3f\PythonScriptWrapper.PY", line 17
For reference, this is what the script looks like
I've confirmed my python is set to public privacy level
Solved! Go to Solution.
Hi @Anonymous ,
//note:You'll need to have the pandas library installed in your Python environment for the previous script code to work properly. To install pandas, run the following command in your Python installation: | > pip install pandas
Please install the pandas library and restart your computer and try again.
# 'dataset' holds the input data for this script
import pandas as pd
completedData = dataset.fillna(method='backfill', inplace=False)
dataset["completedValues"] = completedData["SMI missing values"]
How To Install Pandas In Python? An Easy Step By Step Multimedia Guide
My environment at the time of testing.
python 3.10
Desktop Version: 2.106.883.0 64-bit (June 2022)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
I have same problem but, in my case, the erro is:
"ADO.NET: ΡУţнǿń śçгĭφţ ēґѓог.
<pi>C:\Users\gabri\anaconda3\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\gabri\PythonScriptWrapper_e5b896d1-7f85-4831-9567-a4864b2bcb63\PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\Users\gabri\anaconda3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
numpy:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.9 from "C:\Users\gabri\anaconda3\python.exe"
* The NumPy version is: "1.21.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: Não foi possível encontrar o módulo especificado.
</pi>"
Hi @Anonymous ,
//note:You'll need to have the pandas library installed in your Python environment for the previous script code to work properly. To install pandas, run the following command in your Python installation: | > pip install pandas
Please install the pandas library and restart your computer and try again.
# 'dataset' holds the input data for this script
import pandas as pd
completedData = dataset.fillna(method='backfill', inplace=False)
dataset["completedValues"] = completedData["SMI missing values"]
How To Install Pandas In Python? An Easy Step By Step Multimedia Guide
My environment at the time of testing.
python 3.10
Desktop Version: 2.106.883.0 64-bit (June 2022)
Best Regards,
Gao
Community Support Team
If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!
How to get your questions answered quickly -- How to provide sample data
This fixed it! It looks like I messed up the pandas library install the first time I did it, as when I reinstalled it, it started working!
New error now, after removing indentations, I am getting this error:
DataSource.Error: ADO.NET: Python script error.
<pi>C:\USERS\DSALMONS\ANACONDA3\lib\site-packages\numpy\__init__.py:148: UserWarning: mkl-service package failed to import, therefore Intel(R) MKL initialization ensuring its correct out-of-the box operation under condition when Gnu OpenMP had already been loaded by Python process is not assured. Please install mkl-service package, see http://github.com/IntelPython/mkl-service
from . import _distributor_init
Traceback (most recent call last):
File "C:\Users\dsalmons\PythonScriptWrapper_a7538157-163f-44f8-a836-995f2677be9b\PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\USERS\DSALMONS\ANACONDA3\lib\site-packages\pandas\__init__.py", line 16, in <module>
raise ImportError(
ImportError: Unable to import required dependencies:
I have tried installing the mkl-service package using the github link, but it still gives me the same error
I have a similar error, I am trying to run the code on the data imported from Azure Blob Containter. In my case however it is not the indent, have you ever encoutered this one:
DataSource.Error: ADO.NET: A problem occurred while processing your Python script.
Here are the technical details: [Expression.Error] We couldn't parse the input provided as a Time value.
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=A problem occurred while processing your Python script.
Here are the technical details: [Expression.Error] We couldn't parse the input provided as a Time value.
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonUnexpectedException
I cannot install Anaconda, because I am using this for work in a large company and there is no budget allocated to Anaconda licenses.
P.S. Privacy level is set to Public everywhere.
P.P.S. The Python PATH looks correct.
I was able to fix the error, it has to do with the wrong automatic datatype parsing by Power BI.