API Reference

This section contains the complete API documentation generated from docstrings.

Note

📝 Docstrings missing or unclear? Help us improve by contributing documentation!

Core

dictutils.qsdict(qs, *args[, strict])

Build a nested dict from rows (dicts or objects) by a sequence of selectors.

dictutils.mergedict(*args[, path, update])

Merge multiple nested mappings into a single dict.

dictutils.pivot(d, order)

Pivot a nested dictionary by rearranging the key levels according to order.

dictutils.nestagg.Agg(map[, zero, reduce, ...])

Declarative aggregate specification.

dictutils.nestagg.nest_agg(items, keys, *, aggs)

Build a nested dict keyed by keys, with aggregations at the leaves.

Operations (ops)

dictutils.ops.deep_get(obj, path[, default, ...])

Get value from nested object using dotted path notation or path sequence.

dictutils.ops.deep_set(obj, path, value, *)

Set value in nested object using dotted path notation.

dictutils.ops.deep_del(obj, path)

Delete value from nested object using dotted path notation.

dictutils.ops.deep_has(obj, path)

Check if a path exists in nested object.

dictutils.ops.flatten_paths(d[, prefix, sep])

Flatten nested mappings into dot-notation paths.

dictutils.ops.expand_paths(path)

Parse dotted path string into list of keys.

dictutils.ops.project(d, paths)

Extract only specified paths from nested object.

dictutils.ops.rename_keys(d, mapping)

Rename keys using path mapping.

dictutils.ops.transpose_dict(d)

Transpose a 2D dictionary (swap row/column keys).

dictutils.ops.deep_update(a, b, *[, ...])

Strategy-aware deep update of object a with values from object b.

dictutils.ops.deep_diff(a, b)

Compare two nested structures and return differences.

dictutils.ops.index_by(items, key)

Create dictionary indexed by key function or path.

dictutils.ops.group_by(items, key)

Group items by key function or path.

dictutils.ops.count_by(items, key)

Count items by key function or path.

dictutils.ops.sum_by(items, key, map)

Sum mapped values by key function or path.

dictutils.ops.reduce_by(items, key, *, zero, ...)

Reduce items by key using custom reducer function.

dictutils.ops.rollup_tree(tree, reducers)

Roll up aggregate values from leaves to parents in a tree structure.

dictutils.ops.map_keys(d, fn, *[, deep])

Transform keys in a mapping using a function.

dictutils.ops.map_values(d, fn, *[, deep, ...])

Transform values in a mapping using a function.

dictutils.ops.map_items(d, fn, *[, deep])

Transform both keys and values in a mapping using a function.

dictutils.ops.schema_check(d, schema, *[, mode])

Validate object against a simple schema.

dictutils.ops.coalesce_paths(d, candidates, *)

Return first existing value from candidate paths, optionally setting result to a path.

dictutils.ops.prune(d, *[, remove_empty, ...])

Remove empty values or values matching predicate, recursively.

dictutils.ops.merge_lists_by(a, b, *, key[, ...])

Merge two lists by matching items on a key.

dictutils.ops.patch(d, ops)

Apply JSON-Patch-like operations to an object.

dictutils.ops.where(items, pred)

Filter items by predicate function.

dictutils.ops.match(items, **eq)

Match items by exact field values using dot-path notation.

dictutils.ops.distinct_by(items, key)

Remove duplicates by key function or path.

dictutils.ops.ensure_path(d, path, *[, factory])

Ensure nested path exists and return the container at that path.