Renamer transformer improvement suggestions #820
Replies: 4 comments 3 replies
-
Thanks @damienwojtowicz, I like this proposal! I think @AdilZouitine had some thoughts on this. Adil, can I let you own this one? |
Beta Was this translation helpful? Give feedback.
-
Hi @damienwojtowicz, @MaxHalford yes! |
Beta Was this translation helpful? Give feedback.
-
I would suggest thinking about what happens when a feature is missing. You might also want to add a unit test for that :) |
Beta Was this translation helpful? Give feedback.
-
@AdilZouitine I'll take a look and make a PR soon then (I'm thinking about starting to contribute to river), if you're OK with it. Following what Max said, I believe missing features should be ignored (or maybe optionally raise a warning for debugging). It's more flexible IMO. |
Beta Was this translation helpful? Give feedback.
-
Hi all,
Currently, there is no way to rename dictionary keys within a pipeline without resorting to a custom function included in a
FuncTransformer
, sinceRenamer
transformer only allows for prefixing or suffixing dictionary keys. I thinkRenamer
should behave more like panda's rename function for DataFrames, so users can define key renaming rules as aDict[str, str]
. It would behave as follows :Obviously, prefixing and suffixing should be preserved (and perhaps extended by letting users define collections of keys that should not be affected? or maybe picking the one they wish to alter?). I suggest to separate those in a
Prefixer
andSuffixer
transformers :What do you think about it?
Beta Was this translation helpful? Give feedback.
All reactions