Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python check column conditions

from pandas import DataFrame
 
names = {'First_name': ['Hanah', 'Ria', 'Jay', 'Bholu', 'Sachin']}
df = DataFrame(names, columns =['First_name'])
 
df.loc[(df['First_name'] == 'Ria') | (df['First_name'] == 'Jay'), 'Status'] = 'Found' 
df.loc[(df['First_name'] != 'Ria') & (df['First_name'] != 'Jay'), 'Status'] = 'Not Found' 
 
print (df)
Comment

PREVIOUS NEXT
Code Example
Python :: cx_freeze include images in specific path 
Python :: group by weekhour 
Python :: how to update phyton to phycram 
Python :: Which of the following statements is used to create an empty set in Python? 
Python :: remove cooldown discord python 
Python :: what does it mean when i get a permission error in python 
Python :: how to filter csv file by columns 
Python :: django time cualtulate 
Python :: how to register button presses in pysimpleGUI 
Python :: violin plot seaborn 
Python :: grading system in python with nested if 
Python :: Bar Plot Seaborn with No Error Bars 
Python :: shared a local host django 
Python :: python loop invalid input 
Python :: how to get the remainder of a number when dividing in python 
Python :: primary neural network 
Python :: python use orange 
Python :: naiveDateTime last week from current time 
Python :: combining list alternatively 
Python :: mp.solutions.findhands not in python 3.8 
Python :: pybind11 python37_d.dll access violation 
Python :: python pipe where 
Python :: hewwo world 
Python :: the code panda 
Python :: how to get rid of an instance variable python 
Python :: python turtle documentation 
Python :: quicksort python 
Python :: python remove warnings 
Python :: how to comment in python 
Python :: format python decimal 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =