Deutsch   English   Français   Italiano  
<rP2dnYmvr4spNUL_nZ2dnUU7_8zNnZ2d@giganews.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!buffer1.nntp.dca1.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 26 Jul 2022 03:41:23 -0500
Newsgroups: fr.comp.lang.python
Subject: Re: Comparer deux colonnes avec pandas
X-poster: PEAR::Net_NNTP v1.5.0 (stable)
From: gigi123 <nospam_giannivolturno5@gmail.com.invalid>
References: <duOdnQj_K-DtGkP_nZ2dnUU7_83NnZ2d@giganews.com> <tbo20m$1pnml$1@dont-email.me>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 8bit
Organization: !No_Organization!
Message-ID: <rP2dnYmvr4spNUL_nZ2dnUU7_8zNnZ2d@giganews.com>
Date: Tue, 26 Jul 2022 03:41:24 -0500
Lines: 27
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-kkou9vozJCS32TB3A2X7Q5BmEDsTdiVDHZ09CZdA6c2JIjrJpPQJg9JnbO4hXKA6ft07WrGpe2eb5O9!8XxbatLRqAGPn+nSoFeq3Na1acB2AszjFzZJQOa1Mq36ZMwd3REziD4wvek2K513BjUL5hZIDFvH
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Bytes: 2086
X-Original-Lines: 26
X-Original-Bytes: 2002

Le mardi 26 Juillet 2022 à 08:36 par Carboleum :
> Le 25-07-22 Í  14:07, gigi123 a écrit :
>> Bonjour,
>> 
>> VoilÍ  je me trouve coincé sur un sujet concernant python.
>> Je travaille
>> actuellement avec Pandas. J'aimerais comparer deux colonnes dans une
dataframe
>> (que j'ai déjÍ  crée), si le résultat de la
>> première colonne est égale Í  la
>> deuxième colonne, alors la réponse sera la 4ème colonne.
>> 
>> 
>> 
> tu peux utiliser numpy.where(df.colonne1 == df.colonne2, df.colonne4)
> 
> 
> 
> 
> --
> L'absence de virus dans ce courrier électronique a été
> vérifiée par le logiciel antivirus Avast.
> https://www.avast.com/antivirus
Excuser moi je n'avais pas compris, j'ai donc écris cela :
df['Result']=np.where(df['Libellé']==df['Catalogue urnes'],df['Consommables'])

Mais une erreur :
either both or neither of x and y should be given