Python client for DataLLM server
Project description
DataLLM Client
Installation
pip install datallm
Enrich a DataFrame
import pandas as pd
from datallm import DataLLM
datallm = DataLLM(api_key='INSERT_API_KEY')
df = pd.DataFrame({
"age in years": [5, 10, 13, 19, 30, 40, 50, 60, 70, 80],
"gender": ["m", "f", "m", "f", "m", "f", "m", "f", "m", "f"],
"country code": ["AT", "DE", "FR", "IT", "ES", "PT", "GR", "UK", "SE", "FI"],
})
# enrich the DataFrame with a new column containing the official country name
df["country"] = datallm.enrich(df, prompt="official name of the country")
# enrich the DataFrame with first name and last name
df["first name"] = datallm.enrich(df, prompt="the first name of that person")
df["last name"] = datallm.enrich(df, prompt="the last name of that person")
# enrich the DataFrame with a categorical
df["age group"] = datallm.enrich(
df, prompt="age group", categories=["kid", "teen", "adult", "elderly"]
)
# enrich with a boolean value and a integer value
df["isMale"] = datallm.enrich(df, prompt="is Male?", dtype="boolean")
df["income"] = datallm.enrich(df, prompt="annual income in EUR", dtype="integer")
print(df)
Create a DataFrame from Scratch
import pandas as pd
from datallm import DataLLM
datallm = DataLLM(api_key='INSERT_API_KEY')
df = datallm.mock(
n=10,
data_description="Members of the Austrian ski team",
columns={
"full name": {
"prompt": "the full name of the person",
},
"age in years": {
"dtype": "integer",
},
"body weight": {
"prompt": "the body weight in kg",
"dtype": "integer",
},
"body height": {
"prompt": "the body height in cm",
"dtype": "integer",
},
"gender": {
"categories": ["male", "female"],
}
}
)
print(df)
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
datallm-0.2.1.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file datallm-0.2.1.tar.gz
.
File metadata
- Download URL: datallm-0.2.1.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e47f7dee9927d17b167991c21795de3edb29bd723087a98609c32fd4e02a2b85 |
|
MD5 | 793049714043b5a16b0483f4c3ebec42 |
|
BLAKE2b-256 | 76b6c328feff5255e39d9596e881d234f88c2bf306717a6cd7bf44556e09b130 |
File details
Details for the file datallm-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: datallm-0.2.1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91ce07af5520b2ec74ce27dc202d47386ddaecb0eac391342ae7604483f37254 |
|
MD5 | 79566cfd5fd1340b7034126c9d51121c |
|
BLAKE2b-256 | 994ae06f0b5f02245c100618124d8d3bf826e3edba8a06012f0d5700412c0ee0 |