Python libraries : a quick how-to
// updated 2025-11-17 08:52
Python libraries offer a bunch of methods to help us calculate and visualize data, without having to re-invent those methods!
While Python might have some of those methods, the libraries often improve upon them to create more sophisticated results:

Some popular libraries include:
- NumPy ("numerical Python")
- numerical statistics
- Pandas ("panel data")
- data tabularization
- Matplotlib ("math plot library")
- data visualization
- Seaborn
- statistical visualization
Using a library
Libraries follow this "from nothing" approach:
- installation
- import
- programming
Of course, only the "import" and "programming" steps happen on a file-by-file basis!
Installation
If we use a collaborative coding notebook (such as Google Colab), the notebook provider will have installed them already for us; we can skip this step!
If using a local machine (assuming we already have python and pip installed), we run the following command in our Terminal:
pip install librarynameFor example, to install the "pandas" library:
pip install pandasOnce installed, we do not have to run this command again!
Import
To use a library in a Python file:
import librarynameAliasing
Optionally, we can give the library a shortened name, called an alias:
import libraryname as lnThus, we can write shorter lines like:
ln.method()
print(ln)
# instead of
libraryname.method()
print(libraryname)For example:
import pandas as pd
pd.info()Programming
Then, with some data on Python:
data = [ 1, 2, 3, 4 ] # or any kind of collection
ln.some_method(data, some_configuration)Of course, substitute:
some_methodwith an actual method in the librarydatawith our own data variablessome_configwith actual customization properties specified by the library
For example:
import pandas as pd
data = [1, 2, 3, 4]
# my_panda, i.e. "my panel data"
my_panda = pd.DataFrame(data)
print(my_panda)With this basic understanding of Python libraries, we can take any library and start creating charts and graphs quickly with minimal code!
Multiplexing
We certainly can use multiple libraries at once by bundling the import statements at the top of a Python file:
import numpy as np
import pandas as pd
import matplotlib.pyplot as mpl
import seaborn as snsIn fact, most of the time we will work with multiple libraries as we will see that they tend to work together!