Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Hi all,
I'm trying to use Power BI and Python to get a multivariate regression model built in Power BI Desktop. Using Python, I've imported the following packages to get started: pandas, numpy, matplotlib, statsmodels
Let's assume two independent variables (X1 and X2) and 1 dependent variable Y.
When using Python, I've used this script:
import pandas as pd
import numpy as np
import matplotlib as plt
import statsmodels.api as sm
dataframe = pandas.DataFrame["X1 data", "X2 data", "Y data"]
X1 = dataframe["Name of X1 variable"]
X2 = dataframe["Name of X2 variable"]
Y = dataframe["Name of Y variable"]
model = sm.OLS(Y, X)
results = model.fit()
print(results.summary())
Which creates the image <here> , but the command doesn't work in Power BI. Does anyone have any ideas?
Hi @Anonymous ,
Have you defined values to your variable?What is the error returned?
Here is the reference you can refer to.
See, if this can help you out
https://towardsdatascience.com/using-python-in-power-bi-ee95a6b71443
https://www.youtube.com/watch?v=EmALxO7V7y0
https://www.powerobjects.com/blog/2018/10/01/python-starter-power-bi-desktop/
https://powerbi.microsoft.com/en-us/blog/power-bi-desktop-august-2018-feature-summary/#python
First thing I would check is if all of those packages are supported in Power BI. Also, define "does not work", do you get an error, blank screen, Power BI crashes and burns?
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
107 | |
94 | |
76 | |
62 | |
50 |
User | Count |
---|---|
147 | |
106 | |
104 | |
87 | |
61 |