Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
* dev:
  update factory methods
  no need to match filename for datapoints any more
  • Loading branch information
semio committed Mar 9, 2019
2 parents 82ade67 + fe4ebff commit bf2beeb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
3 changes: 1 addition & 2 deletions ddf_utils/factory/cdiac.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def load_metadata(self):

data = pd.read_html(r.content)[0]

data = data.dropna(axis=1, how='all')
data.columns = data.iloc[0]
data = data.dropna(axis=1, how='all').dropna(axis=0, how='all')
data = data.iloc[2:]

data['Last modified'] = pd.to_datetime(data['Last modified'])
Expand Down
6 changes: 5 additions & 1 deletion ddf_utils/factory/igme.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
source link: `CME data portal`_
.. _`CME data portal`: http://www.childmortality.org
Note: This factory class is no longer works as CME website
switched to a javascript app.
"""


Expand All @@ -22,7 +26,7 @@

class IGMELoader(DataFactory):

url = 'http://www.childmortality.org/'
url = 'https://www.childmortality.org/'

def load_metadata(self):
r = requests.get(self.url)
Expand Down
3 changes: 1 addition & 2 deletions ddf_utils/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,7 @@ def create_datapackage(path, gen_schema=True, **kwargs):
schema = {"fields": [], "primaryKey": None}

if 'datapoints' in name_res:
# TODO: judge from headers instead of filename (github#76)
conc, keys = re.match(r'ddf--datapoints--([\w_]+)--by--(.*)', name_res).groups()
keys = re.match(r'ddf--datapoints--.*--by--(.*)', name_res).groups()[0]
primary_keys = keys.split('--')
# print(conc, primary_keys)
for i, k in enumerate(primary_keys):
Expand Down

0 comments on commit bf2beeb

Please sign in to comment.