I have a dataset of used cars, there is a column of prices in the dataset. I want to introduce a new ordinal column with the values (high, medium, and low) considering the prices of cars like so:
| price | ordinal |
|---|---|
| higher than 20,000 | high |
| 10,000-20,000 | medium |
| below 10,000 | low |

what is
apply?applyis a method that apply it's first paramater (lambda) on all rows (or something else depends on second parameter).but, there, and what is our function (lambda):
it just has one parameter (x) and check one
if-else, we can rewite it again:we refer to this type of
if-elseasternary statementorone-line-if-elsewhat-must-do-if-statement-is-trueifstatementelsewhat-must-do-if-statement-is-falseand you can define another ternary in
what-must-do-if-statement-is-falsepart like above,and in
what-must-do-if-statement-is-truepart, using parentheses:(another-ternary)ifstatementelsewhat-must-do-if-statement-is-false