restrutured get_feature_names_out for readability - #8
Conversation
|
Seems like theres plenty of resources/debates about the "guard statement" vs "single exit point" paradigm for functions Since removing the early return here only causes the following code to be indented once, it's still quite readible. In more complex cases, potential multiple indentations would take away from readibility/maintainability rather than help with it I think. |
|
Thank you @dodoarg that was very helpful :) |
|
oh I didn't notice you added the example yourself. Gj @solegalli |
hi @dodoarg
I made some changes to docstrings and restructured the method to get the variable names to try and improve readability.
I'd like to know your opinion on having multiple returns per method.
I've read that having a single exit point in complex functions helps maintain the code in the long run, that is why I try to avoid breaking the flow with a return in the middle of a method. But I'd be keen to know your opinion or if you found resources that suggest otherwise.
Finally, we would need to add an example in the user_guide on how to extract variables from the dataframe index. Would you be able to add it?
We have a toy dataframe that you could use in this file: https://github.com/feature-engine/feature_engine/blob/main/docs/user_guide/timeseries/forecasting/LagFeatures.rst
I went ahead an edited the user guide. If you 'd be so kind to merge this PR, then we are done :)
If there is something you think is not right, please let me know.
Thanks a lot of your help!