Open-Source-Spatial-Clean-Cooking-Tool / OnStove

This repository contain the general code for the Open Source Spatial Clean Cooking Tool OnStove
MIT License
7 stars 9 forks source link

Vectorize indicators extraction #237

Closed camiloramirezgo closed 2 years ago

camiloramirezgo commented 2 years ago

Vectorize the current code of the indicators extraction, as they are currently using apply functions which are too expensive. https://github.com/Open-Source-Spatial-Clean-Cooking-Tool/OnSSTOVE/blob/6ebc539989e8e3cc62f7d3c67f0c6c8b2be75453/onsstove/onsstove.py#L948-L951

We can use np.where to identify the rows where a certain technology was chosen similar to: image

A .loc can also be used and we can check if the indices from the technology classes can be easily match with those from the main dataframe of the model even if they are duplicated indices.