Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

In Nature there are neither rewards nor punishments, there are consequences. -- R. G. Ingersoll


devel / comp.lang.python / Re: How to store the result of df.count() as a new dataframe in Pandas?

SubjectAuthor
o Re: How to store the result of df.count() as a new dataframe inTim Williams

1
Re: How to store the result of df.count() as a new dataframe in Pandas?

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

  copy mid

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

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: tjand...@gmail.com (Tim Williams)
Newsgroups: comp.lang.python
Subject: Re: How to store the result of df.count() as a new dataframe in
Pandas?
Date: Wed, 27 Oct 2021 06:25:29 -0400
Lines: 28
Message-ID: <mailman.76.1635330343.23718.python-list@python.org>
References: <CA+i5JwZtdZgyhVtrL6L3bVuKg4psTo+2jy-Rb=6zJT5VfTQezA@mail.gmail.com>
<CAO39LaSRiDvZPR9p1Jw+vgvTqK6XxEfQeiWojmQVtaV_toW-qw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de F/lBjzqDVUpm9cJwHeBoQQjGj6QYGTyxIt/g6pD1MRnA==
Return-Path: <tjandacw@gmail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=gmail.com header.i=@gmail.com header.b=HoXUEnFa;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.006
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; '26,': 0.07; 'cc:addr
:python-list': 0.09; 'dataframe': 0.09; 'pandas': 0.09;
'subject:result': 0.09; 'cc:no real name:2**0': 0.14;
'url:mailman': 0.15; 'dataframes': 0.16; 'subject:() ': 0.16;
'subject:dataframe': 0.16; 'url:pandas': 0.16; 'wrote:': 0.16;
'tue,': 0.19; 'cc:addr:python.org': 0.20; "i've": 0.22;
'subject:How': 0.23; 'url-ip:188.166.95.178/32': 0.25; 'url-
ip:188.166.95/24': 0.25; 'url:listinfo': 0.25; 'cc:2**0': 0.25;
'url-ip:188.166/16': 0.25; 'tried': 0.26; 'series': 0.28; 'url-
ip:188/8': 0.31; 'objects': 0.32; 'message-id:@mail.gmail.com':
0.32; 'but': 0.32; 'header:In-Reply-To:1': 0.34;
'received:google.com': 0.34; 'question.': 0.35;
'from:addr:gmail.com': 0.35; 'received:209.85': 0.37;
'received:209': 0.39; 'received:209.85.208': 0.39; 'appears':
0.40; 'something': 0.40; 'hello,': 0.40; 'similar': 0.65; '2021':
0.71; 'converted': 0.84; 'shi': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=Y+iKZWkQ/YzVbs+0Fq9PEnUBcua1/rIYG31FBWYe36A=;
b=HoXUEnFaLKJRZRmYucKGmnBBD+JyDJtzuAACOupxZLaGij9roPRTRb548DgQsG17f0
5GHB0lHgcIMkgfWM3tCKQiceC8L6QZh+Tzg+jBmcw4WCqjyvj9Fq2z28VKbRgFeMs5AM
k8gbOL5MOeN7LZc5XYIvYyfTFXXoLmcN/J7cM7pj1yXTXe4hI65Q0IyphEogJg0Bfd44
7CPQxGRTX8o11CiFom4XGdNBOv1FHIUy4J7yNSWS+LCj3iNVyQM/zYubqQ6B6SBAZNky
5SVvIRqJF+l7Nlv/KfL1iw8Udrm5EQnmc7Jb4ZtxC+vwF0m3j3XOQlHUpswU81vAKryx
0TYw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=Y+iKZWkQ/YzVbs+0Fq9PEnUBcua1/rIYG31FBWYe36A=;
b=m9jqKYoXDuMf4MoaYjkcecsmnTCHbpFU4Gk3O5lkmi8XmjgXoAlL1SoCn5uQ2QkGvM
eDIFnSRM3KEWGnqmJumpCGFrAOpPbQz+XWYGI2DESoAy400sfETSq2h4j1iyd6spuQtG
UHoDv9EjoQMPnbUOUeQSyc0uWyQqkqtbHIoeLOk3A2bUnuDQxcEfS3MGTuksGDaCJdMp
S4RT46r0vMEsidlPaXEKcNIPSzEyfQPrMy8bkpw/Aq+pDKEHtED8Ga+U9HBdTTEs8/xo
WvepR0nsp7VSDmpXi5pfLpSKhlVf4pA1eGEC16Rxrnv0/eGG+F9X1/ibPiKr15XFQ8Za
t7gA==
X-Gm-Message-State: AOAM530JcNilU7ODTds/npjFfhIDSBBTVdQ8Vmrnmzxz71uGcFTDXPbv
7OMUydl6/hzR733sES4hyxn4yIaDsSF9tOui5ERyboxaTA==
X-Google-Smtp-Source: ABdhPJwjVzh+kJm0Xh11z07TRgWGvf55Lr+k5y22AWOOA2Umx72POdlaTf/Z0lXl8fKr7GNNgiIsoExtkpA3MAwTRNc=
X-Received: by 2002:aa7:cd44:: with SMTP id v4mr43134627edw.30.1635330341601;
Wed, 27 Oct 2021 03:25:41 -0700 (PDT)
In-Reply-To: <CA+i5JwZtdZgyhVtrL6L3bVuKg4psTo+2jy-Rb=6zJT5VfTQezA@mail.gmail.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.35
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.35
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: <CAO39LaSRiDvZPR9p1Jw+vgvTqK6XxEfQeiWojmQVtaV_toW-qw@mail.gmail.com>
X-Mailman-Original-References: <CA+i5JwZtdZgyhVtrL6L3bVuKg4psTo+2jy-Rb=6zJT5VfTQezA@mail.gmail.com>
 by: Tim Williams - Wed, 27 Oct 2021 10:25 UTC

On Tue, Oct 26, 2021 at 6:36 PM Shaozhong SHI <shishaozhong@gmail.com>
wrote:

> Hello,
>
> The result of df.count() appears to be a series object. How to store the
> result of df.count() as a new dataframe in Pandas?
>
> That is data anyhow.
>
> Regards,
>
> David
> --
> https://mail.python.org/mailman/listinfo/python-list

Have you tried something like

df_count = pd.DataFrame(df.count())
? (Untested, but I've converted Series objects to DataFrames doing something
similar before.)
This is more of a pandas question. Why don't you ask this on stackoverflow?

https://stackoverflow.com/questions/tagged/pandas

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor