Day 5 of 14 30 minVectorised mathsassign()String methods
Create new columns from existing ones. Do maths on whole columns at once, add several columns cleanly with assign(), pick values with conditions, map categories, and work with text using .str methods.
By the end of today you can
- Do arithmetic on whole columns at once (vectorised operations)
- Add one or several columns with assign() and method chaining
- Create columns from conditions with np.where() and pd.cut()
- Replace values with map() and know when apply() is a last resort
- Split, extract and reshape text with .str methods
What's inside
- 5 sections
- 3 diagrams and mind maps
- 9 code examples you can run
- 5-question quiz
- 1Vectorised maths: whole columns at once
- 2assign(): add columns in a chain
- 3Columns from conditions
- 4Replacing values with map()
- 5Text columns: the .str accessor
Sign in free to read this lesson
Get the full lesson with diagrams, runnable code and the quiz. Your progress is saved across devices.
Sign in free