blosc2.Proxy.fields#
- property Proxy.fields: dict#
Dictionary with the fields of
self
.- Returns:
fields – A dictionary with the fields of the Proxy.
- Return type:
dict
See also
Examples
>>> import numpy as np >>> import blosc2 >>> data = np.ones(16, dtype=[('field1', 'i4'), ('field2', 'f4')]).reshape(4, 4) >>> ndarray = blosc2.asarray(data) >>> proxy = blosc2.Proxy(ndarray) >>> # Get a dictionary of fields from the proxy, where each field can be accessed individually >>> fields_dict = proxy.fields >>> for field_name, field_proxy in fields_dict.items(): >>> print(f"Field name: {field_name}, Field data: {field_proxy}") Field name: field1, Field data: <blosc2.proxy.ProxyNDField object at 0x114472d20> Field name: field2, Field data: <blosc2.proxy.ProxyNDField object at 0x10e215be0> >>> fields_dict['field2'][:] [[1. 1. 1. 1.] [1. 1. 1. 1.] [1. 1. 1. 1.] [1. 1. 1. 1.]]