While creating conditional columns in Pandas, we tend to use the ππ©π©π₯π²() method almost all the time. However, ππ©π©π₯π²() in Pandas is nothing but a glorified for-loop. As a result, it misses the whole point of vectorization. Instead, you should use the π§π©.π°π‘ππ«π() method to create conditional columns. It does the same job but is extremely fast.
Don't Create Conditional Columns in Pandas with Apply
Don't Create Conditional Columns in Pandasβ¦
Don't Create Conditional Columns in Pandas with Apply
While creating conditional columns in Pandas, we tend to use the ππ©π©π₯π²() method almost all the time. However, ππ©π©π₯π²() in Pandas is nothing but a glorified for-loop. As a result, it misses the whole point of vectorization. Instead, you should use the π§π©.π°π‘ππ«π() method to create conditional columns. It does the same job but is extremely fast.