Generation

generate functionSat, 28 Jan 2023

There is a Pandas dataframe: date city hotel total_rooms ocup_rooms revenue oper_costs adv_costs profit 0 2021-07-01 Yalta Rapsodia 33 24 78936 25641 19305 33990 1 2021-07-01 Yalta AquaMania 28 14 51156 21756 16380 13020 2 2021-07-01 Yalta Skyline 15 12 38016 11655 8775 17586 3 2021-07-01 Alushta Breeze 36 25 75475 27972 21060 26443 Calculate the scalar value as a percentage for all columns using the following formula: profit / revenue

df['profit_perc'] = df['profit'] / df['revenue']

Questions about programming?Chat with your personal AI assistant