Skip to main content

pyberry

DataDict Class

*Detailed docs to come shortly.

DataDict.select(*keys)

Selects specified keys from the data dictionary. If a key does not exist in all records, it will be omitted from those records.

Parameters:

  • *keys (Any): The keys to select. This can be any number of keys in the DataDict.

Returns:

  • DataDict: A DataDict containing only the selected keys.

DataDict.where(key: str, comparison: str, value: Any)

Filters the DataDict object based on the specified field and comparison. The DataDict object can be treated exactly like a list of dicts, but can also perform more complex queries.

Parameters:

  • key (Any): The key to filter by. This can be any key found in the DataDict.
  • comparison (str): The comparison operator to use. This can be any comparison operator found in the DataDict.
  • value (Any): The value to compare the field to.

Returns:

  • Datadict: A DataDict object containing the filtered dicts.

DataDict.to_float(key: Any)

Converts the values of the specified key to floats. If conversion is not possible, raises a ValueError.
Modifies the DataDict in place.

Parameters:

  • key (Any): The key whose values are to be converted to float.
    Modifies the DataDict in place.

DataDict.to_str(key: Any)

Converts the values of the specified key to strings.
Modifies the DataDict in place.

Parameters:

  • key (Any): The key whose values are to be converted to string.

DataDict.median(key: Any)

Calculates the median of the numerical values in the specified key. If the key contains non-numeric values, raises a ValueError.

Parameters:

  • key (Any): The key for which the median is to be calculated.

Returns:

  • int | float: The median of the key values.

DataDict.mean(key: Any)

Calculates the mean of the numerical values in the specified key. If the key contains non-numeric values, raises a ValueError.

Parameters:

  • key (Any): The key for which the mean is to be calculated.

Returns:

  • int | float: The mean of the key values.

DataDict.max(key: Any)

Calculates the maximum value out of all numerical values in the specified key. If the key contains non-numeric values, raises a ValueError.

Parameters:

  • key (Any): The key for which the maximum value is to be calculated.

Returns:

  • int | float: The maximum value of the key values.

DataDict.min(key: Any)

Calculates the minimum value out of all numerical values in the specified key. If the key contains non-numeric values, raises a ValueError.

Parameters:

  • key (Any): The key for which the minimum value is to be calculated.

Returns:

  • int | float: The minimum value of the key values.

DataDict.tail(n: int = 5)

Returns the last n elements of the data dictionary.

Parameters:

  • n (int): An integer specifying the number of elements to return from the end of the data dictionary (default is 5).

Returns:

  • DataDict: A DataDict representing the last n elements.

DataDict.head(n: int = 5)

Returns the first n elements of the data dictionary.

Parameters:

  • n (int): An integer specifying the number of elements to return from the end of the data dictionary (default is 5).

Returns:

  • DataDict: A DataDict representing the first n elements.

Metadata

Release files for pymelon 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymelon 0.4.0
File Size Uploaded
pymelon-0.4.0.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymelon 0.4.0
File Interpreter ABI Platform
pymelon-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.4 kB

Release files / pymelon-0.4.0.tar.gz

Download URL pymelon-0.4.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
086ed80a6d0a51b01197aacd11d48c31b342d1a078d56a432a3f99e9303af88b
BLAKE2b-256 checksum
How to use checksums
4c4ec5a62d159678d5f530306a7d87faad1204824eede79cadcbd020f989621a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.1

Release files / pymelon-0.4.0-py3-none-any.whl

Download URL pymelon-0.4.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3f381243b8dc98e54853fd6e804d8a67c8af7999b173c9e6e2a1e0c6d7aaa4e
BLAKE2b-256 checksum
How to use checksums
c98eee061c262ccda30158c1e86473a96e1e098bf9d973eb660ede7d2803665b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.11.1

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release 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