Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

134 remove returnkeydict class #135

Merged
merged 11 commits into from
Dec 14, 2023

Conversation

davidhopkinson26
Copy link
Contributor

ReturnKeyDict was used in the past to facilitate leaving unmapped values in the target dataframe unchanged. Pandas also has a Series.replace() method which can achieve this functionality without the need for the ReturnKeyDict class.

This also means we can stop looping over the columns to map in BaseMappingTransformerMixin.transform() as the replace method natively supports reading a dictionary with the first level defining columns to map.

The behaviour of mapping required for MeanResponseTransformer was not preserved with this change. However I have decoupled it from BaseMappingTransformerMixin and implemented MeanResponseTransformer.map_imputer_values() instead since the feature of leaving unmapped values alone is not required here and thus the coupling was unhelpful.

In going through this process I have come to the conclusion that MeanResponseTransformer could do with a refactor!

@davidhopkinson26 davidhopkinson26 marked this pull request as ready for review September 11, 2023 14:18
@davidhopkinson26 davidhopkinson26 linked an issue Sep 11, 2023 that may be closed by this pull request
tubular/nominal.py Show resolved Hide resolved
tubular/nominal.py Show resolved Hide resolved
tubular/nominal.py Show resolved Hide resolved
tubular/nominal.py Show resolved Hide resolved
@davidhopkinson26 davidhopkinson26 merged commit 03e6d1e into develop Dec 14, 2023
1 check passed
@davidhopkinson26 davidhopkinson26 deleted the 134-remove-returnkeydict-class branch December 14, 2023 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove ReturnKeyDict class
2 participants