Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

replace pandas column values based on condition

d.loc[d["conditionDisplayName"] == "Brand New", "conditionDisplayName"] = 6
d.loc[d["conditionDisplayName"] != "Brand New", "conditionDisplayName"] = 4
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #replace #pandas #column #values #based #condition
ADD COMMENT
Topic
Name
1+8 =