Excel - Learn How to Use Python in Excel - Beginners Guide to Python Integration - Episode 2614

preview_player
Показать описание
Microsoft Excel Tutorial - Using Python in Excel.

Today, August 22, 2023, Microsoft will release a preview of Python in Excel. It is a big day for me... I've been trying unsuccessfully to learn Python for ten years. Once Microsoft added it to Excel, I finally have some cool things working.

Welcome to the exciting world of Python in Excel! This is a big day as we explore the new feature that allows us to insert Python code directly into Excel. It's currently in preview mode, but it's already making a huge impact. As someone who has struggled to learn Python in the past, I am thrilled to share this Getting Started guide with you. Trust me, if I can do it, so can you!

I remember buying a book on Python back in 2013, but I just couldn't get the hang of it. The prerequisites and setup were too overwhelming. But now, with the new Insiders Beta, we can easily insert Python code into Excel. In this video, I will be your guide as we dive into the basics of Python. Don't worry, I knew nothing about Python an hour ago, so this is truly a Python 101 lesson.

To get started, simply type =PY into a cell and open the parentheses. You'll notice that the formula bar turns green, indicating that you are now in the Python code editor. Unlike regular formulas, pressing Enter will not accept the code, it will simply move to a new line. To commit the code, you'll need to press Control + Enter. This may take some getting used to, but it's a small price to pay for the power of Python in Excel.

One of the most useful features of Python in Excel is the ability to refer to Excel ranges. Simply type =PY( and use your mouse to select the desired range. You can also choose to return the answer as a value or as a data frame by using the dropdown next to the formula bar or by pressing Ctrl+Alt+Shift+M. This allows for even more flexibility in your code. And don't worry, regular Excel formulas will continue to work as they always have.

Variables are another important aspect of Python in Excel. By creating a variable, you can easily refer to a data frame or range multiple times without having to type it out each time. Just remember to define the variable before using it in your code. And don't forget, the initialization pane has preloaded import statements for commonly used libraries, so you don't have to worry about importing them yourself.

In this video, we also explore the exciting world of data visualization with Python. We use the popular K means clustering algorithm to group customers based on their data points. This is something that was previously difficult to do in Excel, but with Python, it's a breeze. And don't worry, even if you're not familiar with Python, you can easily copy and paste code from the internet and it will work seamlessly in Excel.

I am truly excited about the possibilities that Python in Excel brings. It's currently only available in the Insider's Beta, so make sure to sign up and give it a try. And while there may be a fee for writing Python code in the future, for now, it's completely free. So why not give it a try and see how it can enhance your Excel experience? Thank you for watching and don't forget to like, subscribe, and ring the bell for more Excel tips and tricks. See you next time!

In this video: a getting started with Python in Excel tutorial.
How to open the Python editor in Excel
Ctrl+Enter versus Enter in the Python Editor in Excel
Returning a Value or a Python Object
Referring to an Excel range in Python
Using Variables in Python in Excel
Plotting Data Using Python in Excel
Which Python Libraries are loaded by default?
K-Means Clustering for customer segmentation

Table of Contents:
(0:00) Python in Excel is in preview
(0:29) Python Excel 101
(0:53) =PY( to Open Python Editor
(1:05) Enter is New Line. Ctrl+Enter commits the code.
(1:29) Return as Value or Object with Ctrl+Alt+Shift+M
(2:08) Loading Excel range to Python
(2:33) Show Card of Data Frame
(2:47) Referring to Data Frame
(3:19) Changing Data Frame to Excel Value
(3:37) Using Variables in Excel Python
(4:05) Cell order for variable use
(4:59) Plotting data in Excel with Python
(5:30) Python libraries always loaded
(5:51) K-Means Clustering in Excel Python
(8:15) Recap of Important Excel Python
(9:48) Cost for Python in Excel
(10:42) What are your thoughts?

Рекомендации по теме
Комментарии
Автор

Great tips using python, thanks MR Excel

supercollectionstudio
Автор

Thank you this is exactly what I wanted to see!

rowanans
Автор

Wow I will wait for it after the refresh

urdinka
Автор

That's a very comprehensive test. Thanks for doing it!

ExcelTurbo
Автор

I can understand your teaching much better, simpler than the python pro tutors guess cause I'm near your shoes learning it

hweigarylau
Автор

This is great news. Can't wait to learn some new tricks.

JimFikes
Автор

Thank you Mr Excel for introducing to us this new feature

nadermounir
Автор

I love how you showed your purchased py book from 2013. Can relate 100%

Seftehandle
Автор

Wow finally a moment of clarity on their part.
Mr. Excel, do you think this is a step in replacing VBA with Python?

rickswineberg
Автор

This is great and i am looking forward to more :)

Acrnl
Автор

Very cool indeed. I'm an occasional pythonist. I'm not necessarily convinced by the interface, but I like it. I do like the idea of a toggle on the formula bar but not sure it should be used the way it is, and can't help but think that could have been used for specifying lambdas instead of name manager. For me, returning a cell value or data type should be specified in the code itself. It's not really a setting in my opinion. I like the graphs, but the single cell might be problematic.
A great start though and thanks for bringing it to us!

ricos
Автор

That news on the fee is a right bummer. There are additional fees for AI/Windows CoPilot features and now this, it's all adding up like TV subscriptions. I feel like most businesses will be locked out of this and AI, shame.

koltregaskes
Автор

great!
pandas library in phyton is like power query
and phyton is great tool for data analytics and machine learning, integrating all of this in excel...mind blowing 🤯🤯
i think the best course for python basics there is no best course than CS50 python programing
to have all the story "Accounting Data Analytics " Illinois university coursera course is the best.

DIGITAL_COOKING
Автор

Joy, oh joy, for what seems to be the world's most creative obfuscating complication of a simple range?

Bill_Woo
Автор

great introduction ! i've been waiting for excel+word hybrid for a long time. let me resize column for each table independently(same sheet).

guranslifes
Автор

Exciting!!! but where is the step forward?

johnborg
Автор

When do you think a decent textbook will be available for Python in Excel (not standalone Python)?

adamhindle
Автор

the fee will be to cover the cost of the cloud hosted Conda python environments; if it's possible to get it running using a local python environment then it should be free?

Cookstein
Автор

Please make a new video for forecasting using Python in Excel

moviestrailer
Автор

I have Microsoft 365 and joined to Microsoft 365 Insider beta version. But unfortunately I always get an error code: 30183-28 (400) after pushing update button.
Tried all option what I got from internet (they are almost same) but without any success. Can you help in this please?

Heybat