Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Ability to skip columns #293

Merged
merged 2 commits into from Jan 29, 2020
Merged

Ability to skip columns #293

merged 2 commits into from Jan 29, 2020

Conversation

roll
Copy link
Member

@roll roll commented Jan 28, 2020

@roll
Copy link
Member Author

roll commented Jan 28, 2020

@akariv
@amercader
This adds an ability to skip arbitrary columns for both tabulator and goodtables (see the docs in the changeset)

For example for goodtagles:

data

other1,sample_id,fermentation_id,strain_id,time,other2
,s1,f1,s1,10,some
some,s1,f1,s1,bad,some

metadata

{
  "fields": [
    {
      "type": "string",
      "name": "sample_id",
      "format": "default"
    },
    {
      "type": "string",
      "name": "fermentation_id",
      "format": "default"
    },
    {
      "type": "string",
      "name": "strain_id",
      "format": "default"
    },
    {
      "type": "integer",
      "name": "time",
      "format": "default"
    }
  ]
}

report

{u'error-count': 1,
 u'preset': u'table',
 u'table-count': 1,
 u'tables': [{u'encoding': 'utf-8',
              u'error-count': 1,
              u'errors': [{u'code': u'type-or-format-error',
                           u'column-number': 4,
                           u'message': u'The value "bad" in row 3 and column 4 is not type "integer" and format "default"',
                           u'message-data': {u'field_format': u'"default"',
                                             u'field_type': u'"integer"',
                                             u'value': u'"bad"'},
                           u'row-number': 3}],
              u'format': 'csv',
              u'headers': [u'sample_id',
                           u'fermentation_id',
                           u'strain_id',
                           u'time'],
              u'row-count': 3,
              u'schema': u'table-schema',
              u'scheme': u'file',
              u'source': 'tmp/sample_info.csv',
              u'time': 0.008,
              u'valid': False}],
 u'time': 0.126,
 u'valid': False,
 u'warnings': []}

Copy link
Member

@amercader amercader left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me @roll. Just some nitpicking about the docstrings

README.md Outdated
Comment on lines 852 to 853
When passed, ignores all columns
that listed in the given list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "When passed, ignores all columns included in the given list" is more clear

README.md Outdated
Comment on lines 855 to 856
When passed, ignores all columns
that NOT listed in the given list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps "When passed, ignores all columns that are NOT included in the given list" is more clear

@@ -74,6 +74,14 @@ class Stream(object):
When True, ignores all columns
that have blank headers. Defaults to False.

ignore_listed_headers (List[str], optional):
When passed, ignores all columns
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@roll
Copy link
Member Author

roll commented Jan 29, 2020

@amercader
Thanks!

@roll roll merged commit 2499622 into master Jan 29, 2020
@roll roll deleted the skip_columns branch January 29, 2020 12:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to skip columns
2 participants