只要看一下death_valley_2014.csv,就能发现其中的问题:
2014-2-16,,,,,,,,,,,,,,,,,,,0.00,,,-1
其中好像没有记录2014年2月16日的数据...population_data.json,看看如何着手处理这个文件中的数据:
population_data.json
[
{
"Country Name": "Arab World",
"Country Code": "ARB...",
"Year": "1960",
"Value": "96388069"
},
{
"Country Name": "Arab World",
"Country Code": "ARB...states: 6880000
East Asia & Pacific (all income levels): 2201536674
--snip--
Zimbabwe: 12571000
每个字符串都成功地转换成了浮点数...country_codes.py
from pygal.i18n import COUNTRIES
1 def get_country_code(country_name):
"""根据指定的国家,返回