Skip to main content

NameGender Python

pip install namegender-client
from namegender import NameGender
client = NameGender("YOUR_API_KEY")
result = client.name("Ayşe", country="TR")
print(result["gender"], result["probability"], result["sample_size"], result["confidence"])

Options and response

name, email, username and bulk accept country, ai_fallback and best_guess as keyword arguments:

result = client.name("Andrea", country="IT", best_guess=True)

A result carries query, name, gender, country, probability, sample_size, took_ms, source, confidence and matched_as, alongside credits_charged, credits_remaining, data_version and request_id. Success is the HTTP status: any non-2xx response raises NameGenderError with status and body ({"error", "message", "request_id", "docs"}). Branch on body["error"], not on the message.

Country distribution

Returns the countries a name is recorded in. This is not a country-of-origin or ethnicity inference, and must not be used as one.

result = client.countries("Mehmet", limit=10)
print(result["registrations"])  # [{"country": "FR", "count": 3775, "share": 58.97, "gender": "male", "probability": 99, "source": "insee"}, ...]
print(result["attested_in"])    # ["AL", "AU", "BE", ..., "TR", "US"]
print(result["basis"]["note"])

The two lists are deliberately kept apart. registrations is measured volume and is comparable only among the seven countries that publish counted birth statistics (US, UK, France, Canada, Spain, Ireland, Norway); share is a percentage across those counts alone. attested_in is presence with no weight attached, which is where countries that publish no counts, such as Turkey, Japan and India, appear. Show basis["note"] next to any percentage you display.

limit (1–100, default 25) caps how many counted countries come back in registrations. One credit per request.

Download files

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

Source Distribution

namegender_client-0.3.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

namegender_client-0.3.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file namegender_client-0.3.0.tar.gz.

File metadata

  • Download URL: namegender_client-0.3.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for namegender_client-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9d2e8a68ea0e52fc80fbc8db7be665a5ac40b6ad45048fd24c59a0dd55d4b501
MD5 6af0cc3fc88d97d68ded42dd239fb677
BLAKE2b-256 ccd36dfbab76f19e38a0f2b625ba6ff48f9baf0efc88c65460a5af22983ff102

See more details on using hashes here.

Provenance

The following attestation bundles were made for namegender_client-0.3.0.tar.gz:

Publisher: release.yml on anpekesen/namegender-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file namegender_client-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for namegender_client-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2f0704ecff03c4b7ece966a5788c6193f1fd9c4359eb0f74a5eee4528ba3d2e
MD5 a5287886a5975566a8c379ea47481914
BLAKE2b-256 7ab36cc22c5c007e945d27135cacb284f83aeb9c75114fbf563dc2681a9b1b88

See more details on using hashes here.

Provenance

The following attestation bundles were made for namegender_client-0.3.0-py3-none-any.whl:

Publisher: release.yml on anpekesen/namegender-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page