Skip to content

Commit

Permalink
Merge acefaf3 into 57c3404
Browse files Browse the repository at this point in the history
  • Loading branch information
PyMap committed Oct 12, 2020
2 parents 57c3404 + acefaf3 commit 550bc52
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
'Development Status :: 4 - Beta',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
],
packages=find_packages(exclude=['*.tests']),
install_requires=[
Expand Down
9 changes: 5 additions & 4 deletions synthpop/ipu/ipu.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ def _drop_zeros(df):
"""
def for_each_col(col):
nz = col.nonzero()[0]
return col[nz], nz
nz = col.values.nonzero()[0]
return col.iloc[nz], nz

for (col_idx, (col, nz)) in df.apply(for_each_col, axis=0, raw=True).items():
for (col_idx, (col, nz)) in df.apply(for_each_col, axis=0, raw=False).items():
yield (col_idx, col, nz)


Expand Down Expand Up @@ -63,6 +63,7 @@ class _FrequencyAndConstraints(object):
Total number of columns across household and person classes.
"""

def __init__(self, household_freq, household_constraints, person_freq=None,
person_constraints=None):
hh_cols = ((key, col, household_constraints[key], nz)
Expand Down Expand Up @@ -161,7 +162,7 @@ def _average_fit_quality(freq_wrap, weights):
return sum(
_fit_quality(col, weights[nz], constraint)
for _, col, constraint, nz in freq_wrap.iter_columns()
) / freq_wrap.ncols
) / freq_wrap.ncols


def _update_weights(column, weights, constraint):
Expand Down

0 comments on commit 550bc52

Please sign in to comment.