Ravindra BagaleCourses & study guides मराठी Track your progress

29. Python in Excel

Friends, Python in Excel puts pandas, statistics and Python charts inside a normal Excel cell. No installation, no copying data back and forth. In this module we write our first =PY cell, read Tables with xl(), group and pivot with pandas, draw charts, learn the calculation order and the limits, and finish with a weekly report you can reuse.

What you will learn in this module

  • Know who can use Python in Excel, on which platforms, and what standard vs premium compute means
  • Start Python cells with Insert Python, =PY or Ctrl+Alt+Shift+P and commit with Ctrl+Enter
  • Read cells and Tables with xl() and work with DataFrames
  • Choose between Python object and Excel value output
  • Group, aggregate and pivot with pandas; draw Matplotlib and seaborn charts
  • Follow row-major calculation order, understand cloud execution, errors and limits, and build a reusable weekly report

Live story: From Jupyter to one Excel cell

Suppose Amir used to export the Blinkit sheet to CSV every Monday, run pandas in Jupyter, and paste the city totals back into Excel. Copy-paste mistakes crept in twice a month. With Python in Excel the same groupby lives in a cell of the team workbook, refreshes when the Table changes, and sits next to a SUMIFS check. The Monday report now takes ten minutes and nobody has to install Python.

All numbers in this story are fictional practice data.

Fictional practice data

Every name, number and company detail in this module is made up for class. It is not the data of Blinkit, Amazon or any real firm.

Concepts in this chapter

  1. 29.1What Python in Excel Is: Availability and Licensing
  2. 29.2Your First =PY Cell: Insert Python, Ctrl+Alt+Shift+P and Ctrl+Enter
  3. 29.3xl() References and DataFrames: Reading a Whole Table into Python
  4. 29.4Python Object or Excel Value: Choosing the Output Type
  5. 29.5pandas groupby in Excel: Totals, Several Measures and a Pivot Table
  6. 29.6Charts with Matplotlib and seaborn in Python in Excel
  7. 29.7Calculation Order, Cloud Execution, Errors and Limits
  8. 29.8Mini Project: A Weekly City Report with Python in Excel

Review and practice

  1. ★Practice and Answer Key: Analyse 8 Orders with Python in Excel

The chapter recap is at the end of the last concept page.

Quick revision cards

Quick revision

Revise this chapter in two minutes. Save the cards on your phone or download them as PNG files. All names and numbers are made up for practice.

Revision card: Python in Excel: read a table and total it. Example data table with Read the Orders table into Python: 3 rows, 2 columns; Total of the Amount column: 1000; Total per city: Nashik 300, Pune 700.
Card 1 of 2: Python in Excel: read a table and total it · Download PNG
Revision card: pandas cheat sheet. Covers Total by city; Average; Only Pune; Top 3; Row count. With a photo of Ravindra Bagale and a short tip.
Card 2 of 2: pandas cheat sheet · Download PNG

More cards for every chapter: Ravi Sir's Cards.