Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"Gort, klaatu nikto barada." -- The Day the Earth Stood Still


devel / comp.lang.python / Re: double bracket integer index in pandas; Is this a legal syntax

SubjectAuthor
o Re: double bracket integer index in pandas; Is this a legal syntaxCameron Simpson

1
Re: double bracket integer index in pandas; Is this a legal syntax

<mailman.18.1683114785.13552.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=23100&group=comp.lang.python#23100

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!news.szaf.org!fu-berlin.de!uni-berlin.de!not-for-mail
From: cs...@cskk.id.au (Cameron Simpson)
Newsgroups: comp.lang.python
Subject: Re: double bracket integer index in pandas; Is this a legal syntax
Date: Wed, 3 May 2023 21:37:24 +1000
Lines: 35
Message-ID: <mailman.18.1683114785.13552.python-list@python.org>
References: <CAP0EqC_MftdW_aR8kt0aMeiV7bV2qRm6+CAXsy11jHwK7m9U_A@mail.gmail.com>
<ZFJHdNqVCbt/k/mz@cskk.homeip.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
X-Trace: news.uni-berlin.de G6HEKcBkFFLioLgGSc8aCwDi4URVjvBvBHz968YShLcg==
Return-Path: <cameron@cskk.id.au>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=none reason="no signature";
dkim-adsp=none (unprotected policy); dkim-atps=neutral
X-Spam-Status: OK 0.002
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'linux': 0.09; 'macos':
0.09; 'page:': 0.09; 'pandas': 0.09; 'ubuntu': 0.09; 'cheers,':
0.11; '>>>>': 0.16; 'cameron': 0.16; 'dataframe.': 0.16;
'expects': 0.16; 'from:addr:cs': 0.16; 'from:addr:cskk.id.au':
0.16; 'from:name:cameron simpson': 0.16; 'index:': 0.16; 'message-
id:@cskk.homeip.net': 0.16; 'simpson': 0.16; 'subject:; ': 0.16;
'subject:integer': 0.16; 'subject:syntax': 0.16; 'subset': 0.16;
'url-ip:104.26.0.204/32': 0.16; 'url-ip:104.26.1.204/32': 0.16;
'url-ip:172.67.71.236/32': 0.16; 'url:pandas': 0.16; 'url:pydata':
0.16; 'wrote:': 0.16; 'to:addr:python-list': 0.20; 'list,': 0.24;
'depends': 0.25; 'tried': 0.26; 'header:User-Agent:1': 0.30;
'there': 0.33; 'particular': 0.33; 'header:In-Reply-To:1': 0.34;
'two': 0.39; 'valid': 0.39; 'list': 0.39; '(with': 0.39; 'double':
0.40; 'here.': 0.61; 'url-ip:104.26/16': 0.64; 'your': 0.64;
'look': 0.65; 'received:userid': 0.66; 'subject:this': 0.67;
'[1]': 0.67; 'header:Received:6': 0.67; 'received:172.16': 0.76;
'url-ip:104.26.0/24': 0.76; 'url-ip:104.26.1/24': 0.76
Mail-Followup-To: python-list@python.org
Content-Disposition: inline
In-Reply-To: <CAP0EqC_MftdW_aR8kt0aMeiV7bV2qRm6+CAXsy11jHwK7m9U_A@mail.gmail.com>
User-Agent: Mutt/2.2.7 (2022-08-07)
X-tce-id: cskk@bigpond.com
X-tce-ares-id: ares-e{6aa9cba5-124a-493f-b2d1-75a17a0de5b0}1
X-tce-spam-action: no action
X-tce-spam-score: 0.0
X-Cm-Envelope: MS4xfHRe/rnxkcg32TidldgwdLQdvRhTjRfFCW4qDx4oFJUDoX3zsYoa5eg6kfDmsglT5aVU9tQCD6+NMb3mZZHaFaouqkHwJMfImUlzUT4j8SOlJZWWKeap
9PRU/1s6hopd2lT1U3GuWoh9e+H+m2mBZUQ+xOxO3Lb/RWTH6BhKhi2CNi/LUk1D5uSTlcc095ckHg==
X-Cm-Analysis: v=2.4 cv=Rs0DbgqK c=1 sm=1 tr=0 ts=64524777
a=rjke7w896IuYF4X1w0zxwg==:117 a=rjke7w896IuYF4X1w0zxwg==:17
a=kj9zAlcOel0A:10 a=P0xRbXHiH_UA:10 a=pGLkceISAAAA:8 a=25HwlqTDAAAA:8
a=mjKHfwxT368DCSSbPXMA:9 a=CjuIK1q_8ugA:10 a=83siYKtSrjUA:10
a=EmcZzROXtpcerfTzG-js:22
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.39
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: <https://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>
X-Mailman-Original-Message-ID: <ZFJHdNqVCbt/k/mz@cskk.homeip.net>
X-Mailman-Original-References: <CAP0EqC_MftdW_aR8kt0aMeiV7bV2qRm6+CAXsy11jHwK7m9U_A@mail.gmail.com>
 by: Cameron Simpson - Wed, 3 May 2023 11:37 UTC

On 03May2023 03:41, Artie Ziff <artie.ziff@gmail.com> wrote:
>I am hope that pandas questions are OK here.

There are some pandas users here.

>In a panda lecture, I did not get the expected result.
>I tried this on two different platforms
>(old macOS distro and up-to-date Ubuntu Linux distro, 22.04)
>
>The Linux distro has:
>python 3.10.11
>pandas 1.5.2
>conda 23.3.1
>
>Is this double bracket form, df[[1]], deprecated... maybe?
>
>There is data in a dataframe, df.
>
>>>> subset = df[[1]]

Whether this works depends on the contents of the dataframe. You're
supplying this index:

[1]

which is a list of ints (with just one int).

Have a look at this page:
https://pandas.pydata.org/docs/user_guide/indexing.html

If you suppply a list, it expects a list of labels. Is 1 a valid label
for your particular dataframe?

Cheers,
Cameron Simpson <cs@cskk.id.au>

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor