Skip to content

Commit

Permalink
Merge branch 'revert-population-changes-#160180515' into rel-5.2.297
Browse files Browse the repository at this point in the history
  • Loading branch information
Crunch.io Jenkins Account committed Aug 30, 2018
2 parents 60dcc40 + 802ba10 commit fa6c892
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 460 deletions.
14 changes: 1 addition & 13 deletions src/cr/cube/crunch_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,18 +1016,6 @@ def percentages(self, axis=None):
'''
return self.proportions(axis) * 100

@lazyproperty
def population_fraction(self):
try:
unfiltered, filtered = self.counts
num = filtered.get('weighted_n')
den = unfiltered.get('weighted_n')
return num / den
except ZeroDivisionError:
return np.nan
except:
return 1

def population_counts(self, population_size, weighted=True,
include_missing=False,
include_transforms_for_dims=None, prune=False):
Expand Down Expand Up @@ -1060,7 +1048,7 @@ def population_counts(self, population_size, weighted=True,
include_missing=include_missing,
include_transforms_for_dims=include_transforms_for_dims,
prune=prune
) * population_size * self.population_fraction
) * population_size

def index(self, weighted=True, prune=False):
'''Get cube index measurement.'''
Expand Down
6 changes: 0 additions & 6 deletions src/cr/cube/mixins/data_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,6 @@ def flat_values(self, weighted, margin=False):
def _shape(self):
return tuple([dim.shape for dim in self.all_dimensions])

@lazyproperty
def counts(self):
unfiltered = self._cube['result'].get('unfiltered')
filtered = self._cube['result'].get('filtered')
return unfiltered, filtered

def data(self, weighted, margin=False):
'''Get the data in non-flattened shape.
Expand Down
1 change: 0 additions & 1 deletion tests/integration/fixtures/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,3 @@ def _load(cube_file):
CAT_X_CAT_PRUNING_HS = _load('cat-x-cat-pruning-hs.json')
CA_ITEMS_X_CA_CAT_X_CAT = _load('ca-items-x-ca-cat-x-cat.json')
CAT_X_MR_X_CAT = _load('cat-x-mr-x-cat.json')
CAT_X_CAT_FILTERED_POP = _load('cat-x-cat-filtered-population.json')
Loading

0 comments on commit fa6c892

Please sign in to comment.