Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'binary': 0.07; 'already.': 0.09; 'builtin': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:number': 0.09; 'utilizing': 0.09; 'wrote': 0.14; 'array.': 0.16; 'numpy': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'specific,': 0.16; 'subject:Convert': 0.16; 'subject:array': 0.16; 'zeros': 0.16; 'trying': 0.19; 'written': 0.21; 'seems': 0.21; '>>>': 0.22; 'print': 0.22; 'own.': 0.24; 'header:X-Complaints- To:1': 0.27; 'array': 0.29; 'consisting': 0.31; 'decimal': 0.31; 'int,': 0.31; 'problem': 0.35; 'but': 0.35; 'representing': 0.36; 'wrong': 0.37; 'e.g.': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'even': 0.60; "you've": 0.63; 'email addr:gmail.com': 0.63; 'more': 0.64; 'wish': 0.70; 'converters': 0.84; 'subject::': 0.85; 'numbers:': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dave Angel Subject: Re:Convert numpy array to single number Date: Mon, 28 Apr 2014 15:19:13 -0400 (EDT) Organization: news.gmane.org References: <088cdf75-f196-404b-ba77-567559f431d8@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: dpc6744197045.direcpc.com X-Newsreader: PiaoHong.NewsGroup.Client.VIP:1.52 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1398712391 news.xs4all.nl 2833 [2001:888:2000:d::a6]:51608 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:70690 mboyd02255@gmail.com Wrote in message: > 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. > One thousand and ten is an int, not an array. So is 10, but it seems a more likely value you might be trying for. As for using the builtin binary converters, you'd better be a lot more specific, as you cannot even print an int in decimal form without utilizing them. The number is in binary already. Please copy the exact problem and constraints, as well as what you've written so far and what's wrong with it. -- DaveA