Path: csiph.com!usenet.pasdenom.info!aioe.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Tom P Newsgroups: comp.lang.python Subject: Re: Convert numpy array to single number Date: Tue, 29 Apr 2014 17:42:17 +0200 Lines: 16 Message-ID: References: <088cdf75-f196-404b-ba77-567559f431d8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net oFVfENtBtnOSqCj+rbw0GgRg+wpbBv35RFNvurwvzn1K1Mj2U= Cancel-Lock: sha1:z5NQbhlyFysfHwJR7b7VlDPXfzg= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 In-Reply-To: <088cdf75-f196-404b-ba77-567559f431d8@googlegroups.com> Xref: csiph.com comp.lang.python:70714 On 28.04.2014 15:04, mboyd02255@gmail.com wrote: > I have a numpy array consisting of 1s and zeros for representing binary numbers: > > e.g. > > >>> binary > array([ 1., 0., 1., 0.]) > > I wish the array to be in the form 1010, so it can be manipulated. > > I do not want to use built in binary converters as I am trying to build my own. > Do you mean that each element in the array represents a power of two? So array([ 1., 0., 1., 0.]) represents 2^3 + 2 = 6 decimal?