本文整理匯總了Python中numpy.core.numerictypes.flexible方法的典型用法代碼示例。如果您正苦於以下問題:Python numerictypes.flexible方法的具體用法?Python numerictypes.flexible怎麽用?Python numerictypes.flexible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類numpy.core.numerictypes
的用法示例。
在下文中一共展示了numerictypes.flexible方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _getformats
# 需要導入模塊: from numpy.core import numerictypes [as 別名]
# 或者: from numpy.core.numerictypes import flexible [as 別名]
def _getformats(data):
"""
Returns the formats of arrays in arraylist as a comma-separated string.
"""
if hasattr(data, 'dtype'):
return ",".join([desc[1] for desc in data.dtype.descr])
formats = ''
for obj in data:
obj = np.asarray(obj)
formats += _typestr[obj.dtype.type]
if issubclass(obj.dtype.type, ntypes.flexible):
formats += repr(obj.itemsize)
formats += ','
return formats[:-1]
示例2: _getformats
# 需要導入模塊: from numpy.core import numerictypes [as 別名]
# 或者: from numpy.core.numerictypes import flexible [as 別名]
def _getformats(data):
"Returns the formats of each array of arraylist as a comma-separated string."
if hasattr(data, 'dtype'):
return ",".join([desc[1] for desc in data.dtype.descr])
formats = ''
for obj in data:
obj = np.asarray(obj)
formats += _typestr[obj.dtype.type]
if issubclass(obj.dtype.type, ntypes.flexible):
formats += repr(obj.itemsize)
formats += ','
return formats[:-1]