frictionlessdata / datapackage-py

A Python library for working with Data Packages.
https://frictionlessdata.io
MIT License
189 stars 44 forks source link

Impossible to replicate Resource README example #223

Closed aborruso closed 5 years ago

aborruso commented 5 years ago

Hi, in the README repo file we have this input

city,location
london,"51.50,-0.11"
paris,"48.85,2.30"
rome,N/A

And than

resource = Resource({path: 'data.csv'})
resource.tabular # true
resource.headers # ['city', 'location']
resource.read(keyed=True)

When I run resource = Resource({path: 'data.csv'}) I have name 'path' is not defined error.

What's my error?

Thank you

aborruso commented 5 years ago

Solved using resource = Resource({u'path': 'data.csv'})

Leeeeeee001 commented 5 years ago

Solved using resource = Resource({u'path': 'data.csv'})

The result that "print(resource.headers) # ['city', 'location'] ", is not "['city', 'location'] ", but None. code: from datapackage import * resuil path = r'https://raw.githubusercontent.com/frictionlessdata/datapackage-py/master/data/data.csv' resource = Resource({'path': path}) print(resource.tabular) # true print(resource.headers) # ['city', 'location'] print(resource.read(keyed=True))

result: True None [{'city': 'london', 'location': '51.50,-0.11'},................