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

undefined variable in _iter_from_tabulator function #96

Closed
ndkv opened this issue Aug 17, 2016 · 4 comments · Fixed by #102
Closed

undefined variable in _iter_from_tabulator function #96

ndkv opened this issue Aug 17, 2016 · 4 comments · Fixed by #102
Assignees
Labels
Milestone

Comments

@ndkv
Copy link
Contributor

ndkv commented Aug 17, 2016

The value variable on line 325 in resource.py is undefined.

I encountered it while running the example code in the README.

import datapackage

dp = datapackage.DataPackage('http://data.okfn.org/data/core/gdp/datapackage.json')
brazil_gdp = [{'Year': int(row['Year']), 'Value': float(row['Value'])}
              for row in dp.resources[0].data if row['Country Code'] == 'BRA']

This throws a NameError for value in the _iter_from_tabulator function. Note: this error is not caught by Travis.

I'm not familiar with jsontableschema and can't quickly see how to fix this. Any help is greatly appreciated as I'd like to address #63.

@roll roll self-assigned this Aug 17, 2016
@ndkv
Copy link
Contributor Author

ndkv commented Aug 17, 2016

In addition, the example code will always fail because the dates in the referenced data package are formatted as yyyy which cannot be cast by jsontableschema.types.date.DateType as there is no cast_yyyy() function.

Adding one is easy but I'm not sure whether that's the desired solution.

@danfowler
Copy link

danfowler commented Aug 18, 2016

@ndkv Thanks for flagging! For your second issue, as of the current spec (http://specs.frictionlessdata.io/json-table-schema/#date), that datapackage.json should actually use this for the date:

"pattern": "fmt:%Y"

However, this is not particularly well liked and is currently under discussion for replacement: frictionlessdata/datapackage#260 (your thoughts welcome!)

We should update the gdp dataset to at least match the current spec, but it might break the old OpenSpending (https://openspending.org/) which relies on this formatting and might be pulling in that dataset.

This was referenced Aug 18, 2016
@s-celles
Copy link

s-celles commented Aug 18, 2016

See also: datasets/gdp#5

This was referenced Aug 19, 2016
@roll roll added this to the datapackage-v1 milestone Aug 19, 2016
@roll roll closed this as completed in #102 Aug 19, 2016
@roll roll removed the progress label Aug 19, 2016
@ndkv
Copy link
Contributor Author

ndkv commented Aug 19, 2016

@danfowler Right, thanks for explaining the issue. I have to agree that fmt:%Y doesn't feel right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants