Skip to main content

Pandas extension with NLP functionalities

Project description

NLP Pandas

It's an extension for pandas providing some NLP functionalities for strings.

build version

Installation

Install with:

pip install -U pandas-nlp

Requirements

  • python >= 3.8

Key features

Language detection

import pandas as pd
import pandas_nlp

df = pd.DataFrame({
    "id": [1, 2, 3, 4, 5],
    "text": [
        "I like cats",
        "Me gustan los gatos",
        "M'agraden els gats",
        "J'aime les chats",
        "Ich mag Katzen",
    ],
})
df.text.nlp.language()

Output

0    en
1    es
2    ca
3    fr
4    de
Name: text_language, dtype: object

String embedding

import pandas as pd
import pandas_nlp

df = pd.DataFrame(
    {"id": [1, 2, 3], "text": ["cat", "dog", "violin"]}
)
df.text.nlp.embedding()

Output

0    [2.0860276, 0.78038394, 0.20159146, -1.2828196...
1    [0.96052396, 1.0350337, 0.11549556, -1.2252672...
2    [1.2934866, 0.10021937, 0.71453714, -1.3288003...
Name: text_embedding, dtype: object

String embedding

import pandas as pd
import pandas_nlp

df = pd.DataFrame(
    {"id": [0, 1], "text": ["Hello, how are you?", "Code. Sleep. Eat"]}
)
df.text.nlp.sentences()

Output

0    [Hello, how are you?]
1     [Code., Sleep., Eat]
Name: text_sentences, dtype: object

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pandas-nlp-0.4.0.tar.gz (3.8 kB view hashes)

Uploaded Source

Built Distribution

pandas_nlp-0.4.0-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page