gnd_subject_categories#

gnd_subject_categories(
*,
language: Literal['de', 'en'] | None = None,
normalize: UnicodeForm | None = None,
) → DataFrame#

Subject categories of the Integrated Authority File (GND).

This function returns the subject categories of the Integrated Authority File (GND). The subject categories are taken from the DNB’s Linked Data Service and are returned in NFC normal form by default.

Added in version 0.2.0.

Parameters:
language{‘de’, ‘en’}

Reduces the vocabulary to the columns relevant to the selected language.

normalize{‘NFC’, ‘NFKC’, ‘NFD’, ‘NFKD’}

Transliterates all strings in the vocabulary into the specified Unicode normal form.

Returns:
DataFrame

The subject categories as a Polars DataFrame

Raises:
ValueError

If an unknown language code or Unicode normal form is given.

Notes

Since the metadata typically links to the notation rather than the URI, the notation column has been converted to an enum type to achieve the best possible performance compared to using strings. This may result in conversions (cast) in other datasets. The enum data type can then be easily taken from the notation column.

Examples

By default, the labels for the concepts are returned in German (de) and English (en):

>>> from marc21_learn.vocabularies import gnd_subject_categories
>>>
>>> df = gnd_subject_categories()
>>> assert df.height == 412
>>> assert df.width == 4
>>>
>>> df.head(3)
shape: (3, 4)
┌─────────────────────────────────┬──────────┬─────────────────────────────────┬─────────────────────────────────┐
│ uri                             ┆ notation ┆ label_de                        ┆ label_en                        │
│ ---                             ┆ ---      ┆ ---                             ┆ ---                             │
│ str                             ┆ enum     ┆ str                             ┆ str                             │
╞═════════════════════════════════╪══════════╪═════════════════════════════════╪═════════════════════════════════╡
│ https://d-nb.info/standards/vo… ┆ 00       ┆ Unspezifische Allgemeinwörter   ┆ Non-specific headings           │
│ https://d-nb.info/standards/vo… ┆ 00m      ┆ Maschinell eingespielte Datens… ┆ Machine-generated records (pla… │
│ https://d-nb.info/standards/vo… ┆ 00p      ┆ Sachlich nicht klassifizierbar… ┆ Persons not classifiable by su… │
└─────────────────────────────────┴──────────┴─────────────────────────────────┴─────────────────────────────────┘

To restrict the columns to one of the languages, you can use the language parameter. Note that the column name changes from label_{de, en} to label.

>>> from marc21_learn.vocabularies import gnd_subject_categories
>>>
>>> df = gnd_subject_categories(language="de")
>>> df.head(3)
shape: (3, 3)
┌─────────────────────────────────┬──────────┬─────────────────────────────────┐
│ uri                             ┆ notation ┆ label                           │
│ ---                             ┆ ---      ┆ ---                             │
│ str                             ┆ enum     ┆ str                             │
╞═════════════════════════════════╪══════════╪═════════════════════════════════╡
│ https://d-nb.info/standards/vo… ┆ 00       ┆ Unspezifische Allgemeinwörter   │
│ https://d-nb.info/standards/vo… ┆ 00m      ┆ Maschinell eingespielte Datens… │
│ https://d-nb.info/standards/vo… ┆ 00p      ┆ Sachlich nicht klassifizierbar… │
└─────────────────────────────────┴──────────┴─────────────────────────────────┘