Pandas extension with NLP functionalities
Project description
NLP Pandas
It's an extension for pandas providing some NLP functionalities for strings.
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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for pandas_nlp-0.4.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | af2d4fe597f402e950200ef8b3c4c2986992d689206f91ae4a3f344b4aa42097 |
|
MD5 | f09dbc72426e830226b548d21d0a32d8 |
|
BLAKE2b-256 | 4b17c231760890a633f47d0ab8acfa4d7cbc410c354c27a324ace85c4714c81c |