Assign Values to Multiple New Columns

Assign Values to Multiple New Columns

If you want to assign values to multiple new columns, instead of assigning them separately, you can do everything in one line of code with df.assign.

In the code above, I first created col3 then use col3 to create col4. Everything is in one line of code.

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran