Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #70714

Re: Convert numpy array to single number

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 <werotizy@freent.dd>
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 <bs9vipF2h3pU1@mid.individual.net> (permalink)
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

Show key headers only | View raw


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?

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Convert numpy array to single number mboyd02255@gmail.com - 2014-04-28 06:04 -0700
  Re: Convert numpy array to single number Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-04-28 14:16 +0000
  Re:Convert numpy array to single number Dave Angel <davea@davea.name> - 2014-04-28 15:19 -0400
  Re: Convert numpy array to single number Tom P <werotizy@freent.dd> - 2014-04-29 17:42 +0200
    Re: Convert numpy array to single number Papp Győző <pappgyozo@gmail.com> - 2014-05-01 15:26 +0200

csiph-web