Ask
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News Sign UpSign In
Project: Testing 18.04
Views: 370
Embed | Download | Raw |
Kernel: Python 3 (Ubuntu Linux)

https://datahub.io

Python 3 (Ubuntu Linux)

from datapackage import Package
package = Package('https://datahub.io/core/world-cities/datapackage.json')
# print list of all resources: print(package.resource_names)
def show(data): for no, line in enumerate(data): print(line) if no > 100: return
# print processed tabular data (if exists any) for resource in package.resources: if resource.descriptor['datahub']['type'] == 'derived/csv': show(resource.read())