# Adding libraries in Python in Excel

**URL:** <https://forum.anaconda.com/t/adding-libraries-in-python-in-excel/79887>\
**Category:** Python in Excel\
**Created:** [August 9, 2024, 12:59pm UTC](https://forum.anaconda.com/t/adding-libraries-in-python-in-excel/79887 "2024-08-09T12:59:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeffrey1magee](https://avatars.discourse-cdn.com/v4/letter/j/f5a800/32.png) [@jeffrey1magee](https://forum.anaconda.com/u/jeffrey1magee)\
**Post date:** [August 9, 2024, 12:59pm UTC](https://forum.anaconda.com/t/adding-libraries-in-python-in-excel/79887/1 "2024-08-09T12:59:55Z")

</div>

Hi there,

Curious if Python in Excel can lemmatize and/or stem. I have tried to import some libraries, such as ‘from nltk.stem import WordNetLemmatizer’. However, it asks me to download the library… Not sure addl Python libraries are an option for Excel?

---

<div class="post-metadata">

**Author:** ![OwenPrice](https://dub1.discourse-cdn.com/anaconda/user_avatar/forum.anaconda.com/owenprice/32/5105_2.png) [@OwenPrice](https://forum.anaconda.com/u/OwenPrice)\
**Post date:** [August 9, 2024, 9:30pm UTC](https://forum.anaconda.com/t/adding-libraries-in-python-in-excel/79887/2 "2024-08-09T21:30:57Z")

</div>

At this time there are a fixed number of corpora pre-downloaded with nltk in Python in Excel.

The details are on [this page](https://support.microsoft.com/en-us/office/open-source-libraries-and-python-in-excel-c817c897-41db-40a1-b9f3-d5ffe6d1bf3e).

> The following corpora are pre-loaded for use with Python in Excel: brown, punkt, stopwords, treebank, vader, and wordnet2022. License: Apache v2.

Here’s an example of stemming which I mocked up in Python in Excel:

```auto
from nltk.stem import PorterStemmer, LancasterStemmer, SnowballStemmer

porter_stemmer = PorterStemmer()
lancaster_stemmer = LancasterStemmer()
snowball_stemmer = SnowballStemmer("english")

words = ["running", "ran", "easily", "fairly"]

data = []
for word in words:
    data.append({
        "Word": word,
        "PorterStemmer": porter_stemmer.stem(word),
        "LancasterStemmer": lancaster_stemmer.stem(word),
        "SnowballStemmer": snowball_stemmer.stem(word)
    })

df = pd.DataFrame(data)

```

 ![image](https://europe1.discourse-cdn.com/anaconda/original/2X/7/7e35594ddcce57a5c91c3b62b4764ef490863448.png)

As for lemmatizing with wordnet, I ran into an issue with my first attempt so I will explore further how to make it work.
