ต่อไปนี้ช้ากว่าวิธีที่กำหนดเวลาที่นี่แต่เราสามารถคำนวณคอลัมน์เพิ่มเติมตามเนื้อหาของคอลัมน์มากกว่าหนึ่งคอลัมน์และสามารถคำนวณค่ามากกว่าสองค่าสำหรับคอลัมน์พิเศษได้
ตัวอย่างง่ายๆโดยใช้เพียงคอลัมน์ "ตั้งค่า":
def set_color(row):
    if row["Set"] == "Z":
        return "red"
    else:
        return "green"
df = df.assign(color=df.apply(set_color, axis=1))
print(df)
  Set Type  color
0   Z    A    red
1   Z    B    red
2   X    B  green
3   Y    C  green
ตัวอย่างที่มีสีมากขึ้นและคอลัมน์ที่นำมาพิจารณามากขึ้น:
def set_color(row):
    if row["Set"] == "Z":
        return "red"
    elif row["Type"] == "C":
        return "blue"
    else:
        return "green"
df = df.assign(color=df.apply(set_color, axis=1))
print(df)
  Set Type  color
0   Z    A    red
1   Z    B    red
2   X    B  green
3   Y    C   blue
แก้ไข (21/06/2019): การใช้ plydata
นอกจากนี้ยังเป็นไปได้ที่จะใช้plydataเพื่อทำสิ่งนี้ (ดูเหมือนว่าจะช้ากว่าการใช้assignและapplyแม้ว่า)
from plydata import define, if_else
ง่าย ๆif_else:
df = define(df, color=if_else('Set=="Z"', '"red"', '"green"'))
print(df)
  Set Type  color
0   Z    A    red
1   Z    B    red
2   X    B  green
3   Y    C  green
ซ้อนกันif_else:
df = define(df, color=if_else(
    'Set=="Z"',
    '"red"',
    if_else('Type=="C"', '"green"', '"blue"')))
print(df)                            
  Set Type  color
0   Z    A    red
1   Z    B    red
2   X    B   blue
3   Y    C  green