Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

Running Python Script inside Power BI

My steps are below: Click OK. Click OK. It gives below:   Though I tested "import os" is OK above, so where is the break? So where did I miss out certain steps?
  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi Anonymous ,

     

    The Power BI Python integration requires the installation of two Python packages:

    • Pandas. A software library for data manipulation and analysis. It offers data structures and operations for manipulating numerical tables and time series. Your imported data must be in a pandas data frame. A data frame is a two-dimensional data structure. For example, data is aligned in a tabular fashion in rows and columns.
    • Matplotlib. A plotting library for Python and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits, such as Tkinter, wxPython, Qt, or GTK+.

     

    The error “No module named pandas ” will occur when there is no pandas library in your environment IE the pandas module is either not installed or there is an issue while downloading the module right.

    So in a console or shell, use the pip command-line tool to install the two packages. The pip tool is packaged with more recent Python versions.

    pip install pandas
    pip install matplotlib

     

    For more information, please refer to:

    Run Python Scripts in Power BI Desktop - Power BI | Microsoft Docs

     

    Best Regards,
    Eyelyn Qin
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.