Numpy에서는 바이너리 데이터를 하나의 변수로 압축 해제해야합니다. 과거에는 Numpy에서 'fromstring'함수를 사용하여 압축을 풀고 첫 번째 요소를 추출했습니다. 바이너리 데이터를 Numpy 타입에 직접 압축을 풀 수 있고 Numpy 배열을 만드는 오버 헤드를 피할 수있는 방법이 있습니까?Numpy는 바이너리 문자열을 하나의 변수로 압축합니다.
>>> int_type
dtype('uint32')
>>> bin_data = '\x1a\x2b\x3c\x4d'
>>> value = numpy.fromstring(bin_data, dtype = int_type)[0]
>>> print type(value), value
<type 'numpy.uint32'> 1295788826
내가 이런 걸하고 싶으면 :이 배열 구조를 생성하는 동안
>>> value = int_type.fromstring(bin_data)
>>> print type(value), value
<type 'numpy.uint32'> 1295788826
흥미롭게도 thx – Qlaus