Data Science Community Question

How do I use the new Python in Excel integration for advanced Data Science forecasting?

Posted on 2025-02-05 • In Data Science • By James Wilson

I just got the 'Python' button in my Excel ribbon! I want to use it to run a Random Forest regression for sales forecasting directly in my spreadsheet instead of exporting everything to a Jupyter Notebook. Has anyone successfully used the 'pandas' and 'scikit-learn' libraries inside Excel yet? How do you handle the data privacy of these cloud-based computations?

3 Answers 15,752 Views

All answers to this question 3 Answers

Kimberly Adams Answered on 2025-02-08
Answered

I’ve been experimenting with Python in Excel for a few months now. It’s fantastic for visualization because you can use Seaborn and Matplotlib directly in the grid. To run a Random Forest, you just use the =PY() function. The integration uses an Anaconda distribution running in the Microsoft Cloud, which means your local machine isn't doing the heavy lifting. Regarding privacy, the data is sent to a secure container and isn't used to train any models, but you should still check with your IT department if you're handling sensitive PII (Personally Identifiable Information).

Brian O'Connor Answered on 2025-02-11
Answered

Does the Python integration support external API calls? I’d love to pull real-time weather data into my sales forecast model without having to set up a separate Power BI or Python script.

James Wilson Commented on 2025-02-14
Commented

Brian, unfortunately, external network calls are disabled in Python in Excel for security reasons. You have to use Power Query to pull the API data into a table first, and then point your Python code to that table. It’s a bit of an extra step, but it keeps the environment secure. I’ve used this method to pull stock prices and then run a Monte Carlo simulation in Python to predict portfolio risk, all within a standard .xlsx file.

Sarah Connor Answered on 2025-02-17
Answered

The best part is that you can return Python objects as Excel values. Converting a dataframe into an Excel table with one click is a massive workflow improvement for us.

Kimberly Adams Commented on 2025-02-20
Commented

Exactly, Sarah. Being able to toggle between a "Python Object" and "Excel Value" makes it so much easier to present the final results to stakeholders who don't know how to code.

Write a Comment

Your email address will not be published. Required fields are marked (*)

Join the LearnersEra Community

Ask questions, share knowledge and learn from professionals across technology, project management and certification topics.

Change Country and Nearest City

Select your country and nearest city to see courses available in your region.