Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AnneSchneider
New Member

Power BI & Python - error

Hi,

 

When trying to connect to a dataset using Python Script, with the code below,import matplotlib.pyplot as plt
import numpy as np
import pandas as pd

dataset = pd.read_csv(« C:\\Users\\Username\\Desktop\\Accidents_Geneve – 2010-2018 – OTC_ACCIDENTS – OpendataSwiss.csv », sep= « ; », encoding = « iso8859_2 »)

 

I get this error message. 

Details: "ADO.NET: Python script error.
<pi> File "C:\Users\A1BY3ZZ\PythonScriptWrapper_21a5ae8e-1eb7-482f-9985-3c4ab1c25618\PythonScriptWrapper.PY", line 16
dataset = pd.read_csv(« C:\\Users\\A1BY3ZZ\\Documents\\Python_Data_Science\\Mini projets »)

^
SyntaxError: invalid character '«' (U+00AB)
</pi>"

 

I tried to install WPy64-3980 located here, but it doesn't work neither

 

C:\Users\A1BY3ZZ\Downloads\WPy64-3980

 

And in Option Global Python Scripting is : 

AnneSchneider_0-1642253468525.png

I have Python 3.7 installed on my PC. 

Would you please help me ? Or have any Tips ? I also have Anaconda installed. I usually use Python through Jupyter NoteBook. 
Thank you ! 

Anne

 

 

5 REPLIES 5
AnneSchneider
New Member

 

 

Hi, here is the code I wrote when trying to use Python as a connector, in Python script window : 

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
dataset = pd.read_csv('OTC_ACCIDENTS.csv',quoting=1, encoding='utf-8')

 

And image bellow.

AnneSchneider_0-1643473148557.png

When trying to excecute I get this error message : 

Details: "ADO.NET: Python script error.
<pi>C:\USERS\x\ANACONDA3\lib\site-packages\numpy\__init__.py:138: 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 "PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
File "C:\USERS\x\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.8 from "C:\USERS\x\ANACONDA3\python.exe"
* The NumPy version is: "1.19.2"

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: The specified module could not be found.

</pi>"

 

 (I am not a developper, I am not very familiar with installing , uninstalling software, version.... how could this be easily solved, please ?  ).  Thanks, Anne

My recommendation would be to start over, deinstall Anaconda and reinstall the plain standard Python3. That will hopefully fix the referencing issue.

lbendlin
Super User
Super User

use single quotes  '  instead of «  etc.

 

pandas.read_csv — pandas 1.3.5 documentation (pydata.org)

Hi @lbendlin 

 

Thank you for your answer, I replaced the " " by ' ' but still have the same error message. Is it anything else I could do, please ?  Thanks. 

This works fine for me.

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
dataset = pd.read_csv('test.csv',quoting=1, encoding='utf-8')

 

Can you show a sanitized version of your Power Query code?

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors