Question 8 asks to combine 2 columns using a lambda function:
combine_lambda = lambda row:
‘{} - {}’.format(row.product_type,
row.product_description)
Can anyone explain if this can be done using an f-string and if so, how that would look like?
Question 8 asks to combine 2 columns using a lambda function:
combine_lambda = lambda row:
‘{} - {}’.format(row.product_type,
row.product_description)
Can anyone explain if this can be done using an f-string and if so, how that would look like?
If I’ve interpreted you correctly the f-string equivalent would be-
If you’re looking for details about f-strings try Python 3's f-Strings: An Improved String Formatting Syntax (Guide) – Real Python or have a web search as there are a few existing tutorials for them.
As an aside, if you’re naming a lambda consider just using a function. Naming it defeats the point somewhat