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


Groups > comp.lang.python > #78847

Re: strange numpy behaviour

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.079
X-Spam-Evidence '*H*': 0.85; '*S*': 0.00; 'mask': 0.09; 'python': 0.11; 'numpy': 0.16; 'right:': 0.16; 'think?': 0.16; 'wrote:': 0.18; 'wed,': 0.18; '>>>': 0.22; 'import': 0.22; 'header:In-Reply- To:1': 0.27; 'am,': 0.29; 'message-id:@mail.gmail.com': 0.30; '>>>>': 0.31; 'george': 0.31; 'linux': 0.33; 'received:google.com': 0.35; 'hat': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'more': 0.64; 'default': 0.69; 'jul': 0.74; '2014,': 0.84; 'trojan': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=ptaT2k/MDhANgQ5vyzUJV5moqBf+HgBIV6KKOXa87sI=; b=OtSkKuYiIx6WzUzThtK6jr2eixSXxOhKP9kfCY9pYAkiYCiC1DTCF5gU+8LSieTOCK QoY/4LKXGgJ0kfxEeHEHw1w1/3y9Imy6mJ0udy4m7MEvC4C4UXVggR5cj+8PHTgxnaXi xYFshPiIaEu2H2Wu8rGEl1CEwfDCr7muSkt9vAVD8jfwrbKYAasG5BKVmx5jHjoPq8XM /U0QBN12hrC9PVz0V7ZplY3fVXIagP7PRqZ9RA7XBZ9YlAW5mSXQAjWuiuRIelMuPCOC PHaQPPaU6ZasFgT/uBYkH2TlbiYEyez5yNoUwa4Ovb/5WZlS0EhL/TkqFTCAM+cQJkoI nDQQ==
X-Received by 10.66.141.77 with SMTP id rm13mr13033956pab.91.1412796012212; Wed, 08 Oct 2014 12:20:12 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <5435665D.5010902@noaa.gov>
References <5435665D.5010902@noaa.gov>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 8 Oct 2014 13:19:32 -0600
Subject Re: strange numpy behaviour
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.14686.1412796015.18130.python-list@python.org> (permalink)
Lines 24
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1412796015 news.xs4all.nl 2937 [2001:888:2000:d::a6]:35945
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:78847

Show key headers only | View raw


On Wed, Oct 8, 2014 at 10:29 AM, George Trojan <george.trojan@noaa.gov> wrote:
> This does not look right:
>
> dilbert@gtrojan> python3.4
> Python 3.4.1 (default, Jul  7 2014, 15:47:25)
> [GCC 4.8.3 20140624 (Red Hat 4.8.3-1)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>>>> import numpy as np
>>>> a=np.ma.array([0, 1], dtype=np.int8, mask=[1, 0])
>>>> a
> masked_array(data = [-- 1],
>              mask = [ True False],
>        fill_value = 999999)
>
>>>> a.data
> array([0, 1], dtype=int8)
>>>> a.filled()
> array([63,  1], dtype=int8)         <------- Why 63?
>>>>
>
> What do you think?

The datatype is int8, the fill value is the default of 999999, and
999999 & 0xff == 63.

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


Thread

Re: strange numpy behaviour Ian Kelly <ian.g.kelly@gmail.com> - 2014-10-08 13:19 -0600

csiph-web