MCPcopy Create free account
hub / github.com/numpy/numpy / from_data

Method from_data

numpy/core/arrayprint.py:1379–1390  ·  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

1377
1378 @classmethod
1379 def from_data(cls, data, **options):
1380 """
1381 This is a second way to initialize StructuredVoidFormat, using the raw data
1382 as input. Added to avoid changing the signature of __init__.
1383 """
1384 format_functions = []
1385 for field_name in data.dtype.names:
1386 format_function = _get_format_function(data[field_name], **options)
1387 if data.dtype[field_name].shape != ():
1388 format_function = SubArrayFormat(format_function, **options)
1389 format_functions.append(format_function)
1390 return cls(format_functions)
1391
1392 def __call__(self, x):
1393 str_fields = [

Callers 2

_get_format_functionFunction · 0.80
_void_scalar_reprFunction · 0.80

Calls 2

_get_format_functionFunction · 0.85
SubArrayFormatClass · 0.85

Tested by

no test coverage detected