-
Notifications
You must be signed in to change notification settings - Fork 40
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
[WIP] Extract missing values (to metadata) #125
Conversation
roll
commented
Feb 27, 2020
- fixes Ability to preserve missingValues in dump frictionlessdata/datapackage-pipelines#177
Pull Request Test Coverage Report for Build 441
💛 - Coveralls |
missing_values = schema.get('missingValues', []) | ||
if not self.extract_missing_values['values']: | ||
self.extract_missing_values['values'] = missing_values | ||
for field in schema.get('fields', []): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you changing the schema?
It's not explained in the README
target = self.extract_missing_values['target'] | ||
values = self.extract_missing_values['values'] | ||
fieldMap = {} | ||
for resource in self.dp.descriptor['resources']: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why this loop?
can't you change descriptor directly?
values = self.extract_missing_values['values'] | ||
fieldMap = {} | ||
for resource in self.dp.descriptor['resources']: | ||
if resource.get('name', 'res') == descriptor.get('name', 'des'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a bit hacky...
if source and key not in source: | ||
continue | ||
if value in values: | ||
fieldMap[key][target][row_number] = value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the empty values go in the schema??
This really contradict the documentation and makes very little sense to me...