vendredi 20 mars 2020

Countif in Python

How to do Count-if in Python?

In Microsoft Excel we can write the formula as IF(COUNTIF($A$2:A2,A2)>1,0,1)

How to do in Python? I am not sure if there is similar function in python.pandas

My data frame is below:

ID (Column.A)      

115306696                               
115306696                               
115243609                               
115243609       

Output for above Data frame will look as below:

Identify Unique ID                                                 
     1                      
     0                      
     1                      
     0              

I look forward for your ideas to resolve this query.

Aucun commentaire:

Enregistrer un commentaire