Deutsch   English   Français   Italiano  
<tbog1e$1t8n8$1@dont-email.me>

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

Path: ...!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: Carboleum <c4rboleum@gmail.com.invalid>
Newsgroups: fr.comp.lang.python
Subject: Re: Comparer deux colonnes avec pandas
Date: Tue, 26 Jul 2022 12:35:26 +0200
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <tbog1e$1t8n8$1@dont-email.me>
References: <duOdnQj_K-DtGkP_nZ2dnUU7_83NnZ2d@giganews.com>
 <tbo20m$1pnml$1@dont-email.me>
 <rP2dnYmvr4spNUL_nZ2dnUU7_8zNnZ2d@giganews.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 26 Jul 2022 10:35:26 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="920e203395f3ce0ce4935973ae37ecd6";
	logging-data="2007784"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/XirZkdIBCqH0DqNAMCK75"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
 Thunderbird/102.0.3
Cancel-Lock: sha1:PRUqFyaZZ5Z2oPTcpInBNFiK8TI=
Content-Language: fr
In-Reply-To: <rP2dnYmvr4spNUL_nZ2dnUU7_8zNnZ2d@giganews.com>
X-Antivirus: Avast (VPS 220726-0, 26-7-2022), Outbound message
X-Antivirus-Status: Clean
Bytes: 1737

Le 26-07-22 à 10:41, gigi123 a écrit :

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

avec un help(np.where), tu verras ce à quoi x et y correspondent. Il 
faut ajouter une valeur à renvoyer lorsque la condition n'est pas remplie.

df['result'] = np.where(df.col1 == df.col2, df.col4, np.nan)


-- 
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
https://www.avast.com/antivirus