Skip to main content

A Python package for converting NACE codes to descriptions and searching

Project description

NACE Converter

A Python package for converting NACE codes to their plaintext descriptions and searching for codes by keywords.

What is NACE?

NACE (Nomenclature of Economic Activities) is the European statistical classification of economic activities. NACE codes are used to classify business activities for statistical purposes.

Installation

pip install naceconverter

Quick Start

import naceconverter as nc

# Get description for a NACE code
description = nc.get_description("01.1")
print(description)  # "Growing of non-perennial crops"

# Works with or without dots
description = nc.get_description("011")
print(description)  # "Growing of non-perennial crops"

# Search for codes containing a keyword
results = nc.search_code('painting')
for result in results:
    print(f"{result['code']}: {result['description']}")

# Get full information about a code
info = nc.get_full_info("01.1")
print(info)
# {'code': '01.1', 'name': 'Growing of non-perennial crops', 'level': 3, ...}

Features

  • Flexible Code Lookup: Handles codes with or without dots (e.g., "01.30" and "0130" return the same result)
  • Fast Search: Search for NACE codes by keywords in descriptions
  • Complete Information: Access full details including hierarchy level, parent codes, and validity dates
  • Zero Dependencies: Pure Python implementation with no external dependencies
  • Included Data: NACE codes data is bundled with the package

API Reference

Module-level Functions

get_description(code: str) -> Optional[str]

Get the plaintext description for a NACE code.

search_code(keyword: str, max_results: Optional[int] = None) -> List[Dict]

Search for NACE codes containing a keyword. Returns a list of matching codes with their descriptions.

search_codes(keyword: str, max_results: Optional[int] = None) -> List[Dict]

Alias for search_code() that returns multiple results.

get_full_info(code: str) -> Optional[Dict]

Get complete information for a NACE code including level, parent code, notes, and validity dates.

NACEConverter Class

For more advanced usage, you can work directly with the NACEConverter class:

from naceconverter import NACEConverter

converter = NACEConverter()
description = converter.get_description("01.1")

Examples

Finding all codes related to agriculture

import naceconverter as nc

results = nc.search_code('agriculture')
for r in results:
    print(f"Code: {r['code']}, Level: {r['level']}, Description: {r['description']}")

Getting parent-child relationships

import naceconverter as nc

info = nc.get_full_info("01.11")
parent_code = info['parentCode']
parent_info = nc.get_full_info(parent_code)
print(f"Parent: {parent_info['name']}")

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

naceconverter-1.0.1.tar.gz (58.2 kB view details)

Uploaded Source

Built Distribution

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

naceconverter-1.0.1-py3-none-any.whl (29.6 kB view details)

Uploaded Python 3

File details

Details for the file naceconverter-1.0.1.tar.gz.

File metadata

  • Download URL: naceconverter-1.0.1.tar.gz
  • Upload date:
  • Size: 58.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for naceconverter-1.0.1.tar.gz
Algorithm Hash digest
SHA256 994cd5b26a6739f5ebf39d298b27a5a15a067df3e5cb9c002657d0629fc197bc
MD5 6e783c09df9d289a1c926b8f2a2d67dd
BLAKE2b-256 54eb91a02a52d4972b9e2603785df1f2c3247a93f17441c8a519890cd4841706

See more details on using hashes here.

File details

Details for the file naceconverter-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: naceconverter-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 29.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for naceconverter-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 86de593dc2129613db767177338560eb56539bf96db407c2940ec6e716799231
MD5 4b281a91bd7dd62ea55e19b48ee0bcd8
BLAKE2b-256 0379378caa38f97d3c6a17f23c7b8d0a21eb5b2ca78be2ac2a10442e4355fe55

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page