# Python in Excel

### `All You Need Is =PY()`&#x20;

Using Python in Excel is as simple as typing “=PY(” in your Excel cell, followed by your Python code. The results of your Python calculations or visualizations will then appear in your Excel worksheet.

For instance, you can use Python code to easily join two complex datasets, right within Excel.&#x20;

<figure><img src="/files/ZyZ4ec2Qu0AoIIKHy0FU" alt=""><figcaption></figcaption></figure>

Leverage robust Python visualization libraries, such as Matplotlib and Seaborn, right in your Excel workbook for comprehensive data representation.

<figure><img src="/files/WZziidrdehK3x1tuLShv" alt=""><figcaption></figcaption></figure>

Elevate your analysis using Python’s powerful libraries such as pandas and statsmodels. Accomplish comprehensive statistical tasks directly within your Excel cells. You don’t need to be a data science expert—Anaconda’s curated Python libraries embedded in Excel make advanced analytics accessible to everyone. 

<figure><img src="/files/hPtRTP9QKNWQ5ZaH4LLp" alt=""><figcaption></figcaption></figure>

This feature doesn’t just bring Python into Excel; it brings the rich ecosystem of Python libraries as well. Libraries like pandas for data manipulation, statsmodels for advanced statistical modeling, and Matplotlib and Seaborn for data visualization are all available in Excel, unlocking a universe of new possibilities for your spreadsheets.

<figure><img src="/files/BXeZBts71RhuwSAPu7ru" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.thedatascienceinterviewproject.com/excel/python-in-excel.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
