Generation

generate functionFri, 27 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 Create a new occupancy_rate column and add a function that will read the values from the formula: ocup_rooms / total_rooms

df['occupancy_rate'] = df.ocup_rooms / df.total_rooms

Questions about programming?Chat with your personal AI assistant