I'm looking to include multiple columns in my lambda function, but am running into key issues which shouldn't be right. I am looking for this line to create a new column that says IF "Decision" is present within the Task, then flag it as a Decision. Otherwise, IF "Milestone" is present in "Projects", mark it as a Milestone. Otherwise, leave it as the current Task Type.
today['New_Type'] = today[['Task','Projects','Type'].apply(lambda x,y,z: "Decision" if "Decision" in x else "Milestone" if "Milestone" in y else z)
Any ideas how to adjust this?
applyalways send one value - single value for single column (Series), single row for more columns - so you have to uselambda row:and laterrow['Task'], etc.