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.0.tar.gz
(7.6 kB
view details)
Built Distribution
File details
Details for the file datallm-0.2.0.tar.gz
.
File metadata
- Download URL: datallm-0.2.0.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 | 4ce4d7ca95799ae6e62073a12894353929bfc549f18ae41f90e4c63977000d98 |
|
MD5 | 4c0ea3740494455815f9adf7ab9824f0 |
|
BLAKE2b-256 | a8a04132b8e05960e4d0fe695f6c04088bed8e1a54db1ffe33a6b8dd580ba30a |
File details
Details for the file datallm-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: datallm-0.2.0-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 | bee85f477f54116a1de451ba5b3863faa92046766d26bfcd7382b35b3c7c5de8 |
|
MD5 | 76c94c3f8d6e48567b972a956205857f |
|
BLAKE2b-256 | ed84da1ee9dbb488f4f686b000c86ab9fb2e387b2b8ea17a904b459800f23931 |