Skip to main content

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.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

datallm-0.2.2-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file datallm-0.2.2.tar.gz.

File metadata

  • Download URL: datallm-0.2.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.0

File hashes

Hashes for datallm-0.2.2.tar.gz
Algorithm Hash digest
SHA256 15f5cf71b4f2c676b9caf2d5bd8dfe1164db83ff2e5ce0da96ac495a2ed9c4a1
MD5 75f75f39a99366e720d712a4208e6c75
BLAKE2b-256 2c3f39f0ecac76b63d2d090399e8f4c3dba509273f938c12c0b45142690b8e9f

See more details on using hashes here.

File details

Details for the file datallm-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: datallm-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.0

File hashes

Hashes for datallm-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0950b471ba416343e963da0bcbbd30d2457a65d60e024e894454e6fc2573b86b
MD5 9eb7d34aa60299035bedf57fa37609ea
BLAKE2b-256 d382cd01c2c7cf4a1f6f59584cb05b59944b0bc633d27f483b12c18008aff965

See more details on using hashes here.

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