<p>numpy.int64λŠ” int의 μΈμŠ€ν„΄μŠ€κ°€ μ•„λ‹™λ‹ˆλ‹€.</p>

에 λ§Œλ“  2013λ…„ 01μ›” 27일  Β·  4μ½”λ©˜νŠΈ  Β·  좜처: numpy/numpy

xlwt에 보고된

λ‹€μŒμ€ numpy λ™μž‘μ— λŒ€ν•œ κ²€μ‚¬μž…λ‹ˆλ‹€(Python 2.7.3, numpy 1.6.2).

>>> import numpy
>>> data = [t(123456) for t in (numpy.int32, numpy.int64, numpy.float64)]
>>> [type(d) for d in data]
[<type 'numpy.int32'>, <type 'numpy.int64'>, <type 'numpy.float64'>]
>>> data
[123456, 123456, 123456.0]
>>> check_types = (int, long, float)
>>> for d in data:
...     for c in check_types:
...         print type(d), repr(c), isinstance(d, c)
...
<type 'numpy.int32'> <type 'int'> True
<type 'numpy.int32'> <type 'long'> False
<type 'numpy.int32'> <type 'float'> False
<type 'numpy.int64'> <type 'int'> False
<type 'numpy.int64'> <type 'long'> False
<type 'numpy.int64'> <type 'float'> False
<type 'numpy.float64'> <type 'int'> False
<type 'numpy.float64'> <type 'long'> False
<type 'numpy.float64'> <type 'float'> True
>>>

numpyκ°€ int64κ°€ μ•„λ‹Œ λ‹€λ₯Έ μ†Œν”„νŠΈμ›¨μ–΄μ—μ„œ int32 및 float64λ₯Ό 인식할 수 μžˆλ„λ‘ ν•˜λŠ” μž‘μ—…μ„ μˆ˜ν–‰ν•œ 것 κ°™μŠ΅λ‹ˆλ‹€.

Proposal numpy.core

κ°€μž₯ μœ μš©ν•œ λŒ“κΈ€

이것은 μ •ν™•ν•©λ‹ˆλ‹€. python 'int'λŠ” 32λΉ„νŠΈ λ˜λŠ” 64λΉ„νŠΈμž…λ‹ˆλ‹€(μ‚¬μš©μžμ— 따라
짓닀; 32λΉ„νŠΈ νŒŒμ΄μ¬μ„ μ‚¬μš©ν•˜κ³  μžˆμœΌλ―€λ‘œ np.int32 λ˜λŠ” np.int64
κ·Έκ²ƒμ—μ„œ νŒŒμƒλ©λ‹ˆλ‹€. np.float32λŠ” 'float'의 μΈμŠ€ν„΄μŠ€λ„ μ•„λ‹™λ‹ˆλ‹€.
λ§ˆμ°¬κ°€μ§€λ‘œ Python 'float'은 특히 λ°°μ •λ°€λ„λ‘œ μ €μž₯λ©λ‹ˆλ‹€.

(numpy intsλŠ” 'int'의 μΈμŠ€ν„΄μŠ€κ°€ _μ•„λ‹™λ‹ˆλ‹€.
λ˜λŠ” 'ν”Œλ‘œνŠΈ', κ·ΈλŸ¬λ‚˜ 무엇이든.)

isinstance(..., int)λŠ” μˆ˜ν–‰ν•˜λ €λŠ” μž‘μ—…μ— λŒ€ν•œ 잘λͺ»λœ λ„κ΅¬μž…λ‹ˆλ‹€. λ§Œμ•½ λ„ˆλΌλ©΄
numpy μœ ν˜•μ„ μ‚¬μš©ν•˜μ—¬ 일반적으둜 μ •μˆ˜λ₯Ό κ°μ§€ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€.
doλŠ” isinstance(..., np.integer)μž…λ‹ˆλ‹€.

2013λ…„ 1μ›” 26일 ν† μš”μΌ μ˜€ν›„ 8μ‹œ 15뢄에 Daniel Vianna [email protected]이 λ‹€μŒκ³Ό 같이 μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.

xlwt https://github.com/python-excel/xlwt/issues/15에 보고된 λŒ€λ‘œ :

λ‹€μŒμ€ numpy λ™μž‘μ— λŒ€ν•œ κ²€μ‚¬μž…λ‹ˆλ‹€(Python 2.7.3, numpy 1.6.2).

import numpy >>> 데이터 = [t(123456) for t in (numpy.int32, numpy.int64, numpy.float64)]>>> [λ°μ΄ν„°μ˜ d에 λŒ€ν•œ μœ ν˜•(d)][,,]>>> data[123456, 123456, 123456.0]>>> check_types = (int, long, float)>>> for d in data:... for c in check_ types:... print type(d), repr(c), isinstance(d, c)...진싀거짓거짓거짓거짓거짓거짓거짓참>>>

numpyκ°€ int32 및 float64λ₯Ό λ§Œλ“œλŠ” μž‘μ—…μ„ μ™„λ£Œν•œ 것 κ°™μŠ΅λ‹ˆλ‹€.
λ‹€λ₯Έ μ†Œν”„νŠΈμ›¨μ–΄μ—μ„œλŠ” 인식할 수 μžˆμ§€λ§Œ int64μ—μ„œλŠ” 인식할 수 μ—†μŠ΅λ‹ˆλ‹€.

β€”
이 이메일에 직접 λ‹΅μž₯ν•˜κ±°λ‚˜ Gi tHubhttps://github.com/numpy/numpy/issues/2951μ—μ„œ ν™•μΈν•˜μ„Έμš”.

λͺ¨λ“  4 λŒ“κΈ€

이것은 μ •ν™•ν•©λ‹ˆλ‹€. python 'int'λŠ” 32λΉ„νŠΈ λ˜λŠ” 64λΉ„νŠΈμž…λ‹ˆλ‹€(μ‚¬μš©μžμ— 따라
짓닀; 32λΉ„νŠΈ νŒŒμ΄μ¬μ„ μ‚¬μš©ν•˜κ³  μžˆμœΌλ―€λ‘œ np.int32 λ˜λŠ” np.int64
κ·Έκ²ƒμ—μ„œ νŒŒμƒλ©λ‹ˆλ‹€. np.float32λŠ” 'float'의 μΈμŠ€ν„΄μŠ€λ„ μ•„λ‹™λ‹ˆλ‹€.
λ§ˆμ°¬κ°€μ§€λ‘œ Python 'float'은 특히 λ°°μ •λ°€λ„λ‘œ μ €μž₯λ©λ‹ˆλ‹€.

(numpy intsλŠ” 'int'의 μΈμŠ€ν„΄μŠ€κ°€ _μ•„λ‹™λ‹ˆλ‹€.
λ˜λŠ” 'ν”Œλ‘œνŠΈ', κ·ΈλŸ¬λ‚˜ 무엇이든.)

isinstance(..., int)λŠ” μˆ˜ν–‰ν•˜λ €λŠ” μž‘μ—…μ— λŒ€ν•œ 잘λͺ»λœ λ„κ΅¬μž…λ‹ˆλ‹€. λ§Œμ•½ λ„ˆλΌλ©΄
numpy μœ ν˜•μ„ μ‚¬μš©ν•˜μ—¬ 일반적으둜 μ •μˆ˜λ₯Ό κ°μ§€ν•˜κ³  μ‹ΆμŠ΅λ‹ˆλ‹€.
doλŠ” isinstance(..., np.integer)μž…λ‹ˆλ‹€.

2013λ…„ 1μ›” 26일 ν† μš”μΌ μ˜€ν›„ 8μ‹œ 15뢄에 Daniel Vianna [email protected]이 λ‹€μŒκ³Ό 같이 μž‘μ„±ν–ˆμŠ΅λ‹ˆλ‹€.

xlwt https://github.com/python-excel/xlwt/issues/15에 보고된 λŒ€λ‘œ :

λ‹€μŒμ€ numpy λ™μž‘μ— λŒ€ν•œ κ²€μ‚¬μž…λ‹ˆλ‹€(Python 2.7.3, numpy 1.6.2).

import numpy >>> 데이터 = [t(123456) for t in (numpy.int32, numpy.int64, numpy.float64)]>>> [λ°μ΄ν„°μ˜ d에 λŒ€ν•œ μœ ν˜•(d)][,,]>>> data[123456, 123456, 123456.0]>>> check_types = (int, long, float)>>> for d in data:... for c in check_ types:... print type(d), repr(c), isinstance(d, c)...진싀거짓거짓거짓거짓거짓거짓거짓참>>>

numpyκ°€ int32 및 float64λ₯Ό λ§Œλ“œλŠ” μž‘μ—…μ„ μ™„λ£Œν•œ 것 κ°™μŠ΅λ‹ˆλ‹€.
λ‹€λ₯Έ μ†Œν”„νŠΈμ›¨μ–΄μ—μ„œλŠ” 인식할 수 μžˆμ§€λ§Œ int64μ—μ„œλŠ” 인식할 수 μ—†μŠ΅λ‹ˆλ‹€.

β€”
이 이메일에 직접 λ‹΅μž₯ν•˜κ±°λ‚˜ Gi tHubhttps://github.com/numpy/numpy/issues/2951μ—μ„œ ν™•μΈν•˜μ„Έμš”.

λ˜ν•œ Python 3μ—μ„œ Numpy의 μ •μˆ˜ μœ ν˜•μ€ κΈ°λ³Έ int μœ ν˜•(κ°€λ³€ 크기 μ •μˆ˜)κ³Ό 관련이 μ—†μŠ΅λ‹ˆλ‹€.

λ‚˜λŠ” Nathaniel이 μ›λž˜ λ³΄κ³ μ„œμ— λŒ€ν•œ 그의 λ©”λͺ¨μ—μ„œ μ™„μ „νžˆ μ •ν™•ν•˜λ‹€κ³  μƒκ°ν•©λ‹ˆλ‹€. NumpyλŠ” numbers.Integral 등을 상속/등둝해야 ν•©λ‹ˆλ‹€. μ΄λŠ” python 2.4 및 2.5의 μ‚­μ œμ— 잘 λ§žμŠ΅λ‹ˆλ‹€. λˆ„κ΅¬λ“ μ§€ μ •μˆ˜ μ’‹μ•„ν•˜λŠ” 것에 λŒ€ν•œ κ΄‘λ²”μœ„ν•œ 인식을 μ›ν•˜λ©΄ μ–΄μ¨Œλ“  numbers.Integral 확인해야 ν•©λ‹ˆλ‹€(λ˜λŠ” λΉ„μŠ·ν•œ 덕 타이핑 __index__ 방법을 μ‹œλ„ν•  수 있음).

#4547 및 1.9.0λΆ€ν„° numpyλŠ” number λͺ¨λ“ˆμ— 숫자λ₯Ό λ“±λ‘ν•©λ‹ˆλ‹€. κ΄€λ ¨ λ‚΄μš©μœΌλ‘œ μ’…λ£Œν•©λ‹ˆλ‹€.

이 νŽ˜μ΄μ§€κ°€ 도움이 λ˜μ—ˆλ‚˜μš”?
0 / 5 - 0 λ“±κΈ‰