熊猫数据包阅读器
pandas-datapackage-reader的Python项目详细描述
熊猫数据包阅读器
轻松地将表格数据从Data Packages加载到pandas数据帧中。
安装
pip install pandas-datapackage-reader
用法
frompandas_datapackage_readerimportread_datapackage# From GitHub repositorycountry_codes=read_datapackage("https://github.com/datasets/country-codes")# From local directorycountry_codes=read_datapackage("country-codes")# Data Package with GeoJSONgeo_countries=read_datapackage("https://github.com/datasets/geo-countries")
数据包中的资源元数据作为字典返回到
_metadata
属性。
country_codes._metadata
包含
{'format': 'csv',
'name': 'country-codes',
'path': 'data/country-codes.csv',
'schema': {'fields': [{'description': 'Country or Area official Arabic short name from UN Statistics Divsion',
'name': 'official_name_ar',
'title': 'official name Arabic',
'type': 'string'},
{'description': 'Country or Area official Chinese short name from UN Statistics Divsion',
'name': 'official_name_cn',
'title': 'official name Chinese',
'type': 'string'},
# ...
许可证
bsd-2子句,请参见LICENSE