Getting to know Python in Excel
- By Liam Bastick and Kathryn Newitt
- 2/25/2026
A quick preview of the preloaded Python libraries
Before we look specifically at the NumPy library, we need to briefly discuss the basics of the Python libraries you will likely encounter. A Python library is a collection of code modules, functions, and other Python objects that can be reused. The Python standard library is written in C and is always distributed with Python. You will find out much more about Python libraries in the next chapter. For now, let’s concentrate on the libraries needed to read Excel data with Python.
The libraries preloaded in Python in Excel have been chosen because of their suitability for working with Excel data. To open the Initialization pane, where you can see the preloaded libraries, click the Initialization button in the Python section of the Formulas tab (see Figure 2-48).
FIGURE 2.48 The Initialization button in the Python section of the Formulas tab opens the Initialization pane.
The tooltip shown in Figure 2-48 suggests that you can change the default settings. At the time of writing, these details are for information only.
The Initialization pane shows the loaded libraries (see Figure 2-49).
FIGURE 2.49 The Initialization pane shows the initialization settings in a read-only environment.
You can see in the Initialization pane that the Python syntax to load a library is import library_full_name as library_alias. You can also see that these libraries are currently preloaded:
NumPy: This library allows you to perform mathematical and logical operations, working with arrays rather than the more cumbersome Python lists you have already seen in action.
pandas: This library, which is built on the NumPy library, is designed for data manipulation and data analysis. The pandas DataFrame is similar to data in an Excel worksheet and is key to reading Excel data as a Python object. A DataFrame contains two-dimensional data and data labels.
Matplotlib: This library allows you to quickly create plots. You will use it in some of the examples later in this book.
statsmodels: As its name implies, this library is for creating and analyzing statistical models.
seaborn: This library has functions that use matplotlib.pyplot to provide access to more complex and varied visualizations.
The remaining libraries and settings allow Python in Excel to function and interact with the user interface. You will learn more about the functionality available with each library and try out some examples in the next chapter. The library we are concerned with here is NumPy.
