MCPcopy
hub / github.com/numpy/numpy / from_data

Method from_data

numpy/_core/arrayprint.py:1476–1488  ·  view source on GitHub ↗

This is a second way to initialize StructuredVoidFormat, using the raw data as input. Added to avoid changing the signature of __init__.

(cls, data, **options)

Source from the content-addressed store, hash-verified

1474
1475 @classmethod
1476 def from_data(cls, data, **options):
1477 """
1478 This is a second way to initialize StructuredVoidFormat,
1479 using the raw data as input. Added to avoid changing
1480 the signature of __init__.
1481 """
1482 format_functions = []
1483 for field_name in data.dtype.names:
1484 format_function = _get_format_function(data[field_name], **options)
1485 if data.dtype[field_name].shape != ():
1486 format_function = SubArrayFormat(format_function, **options)
1487 format_functions.append(format_function)
1488 return cls(format_functions)
1489
1490 def __call__(self, x):
1491 str_fields = [

Callers 2

_get_format_functionFunction · 0.80
_void_scalar_to_stringFunction · 0.80

Calls 2

_get_format_functionFunction · 0.85
SubArrayFormatClass · 0.85

Tested by

no test coverage detected