Skip to content

Commit

Permalink
Merge branch 'pandas-18-compatability' into test-travis-ci
Browse files Browse the repository at this point in the history
  • Loading branch information
toliwaga committed Mar 16, 2016
2 parents bc84f5f + 835ae03 commit 5eede55
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions activitysim/activitysim.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,16 @@ def _check_for_variability(model_design):
expression - under the assumption that you probably wouldn't be using a
variable (in live simulations) if it had no variability. This is a
warning to the user that they might have constructed the variable
incorrectly. It samples 100k rows in order to not hurt performance -
it's likely that if 100k rows have no variability, the whole dataframe
incorrectly. It samples 1000 rows in order to not hurt performance -
it's likely that if 1000 rows have no variability, the whole dataframe
will have no variability.
"""
l = min(1000, len(model_design))
sample = random_rows(model_design, l).describe().transpose()
sample = random_rows(model_design, l)
# convert to float so describe works uniformly on bools
sample = sample.astype('float')
sample = sample.describe().transpose()

error = sample[sample["std"] == 0]
if len(error):
print "WARNING: Some columns have no variability:\n", \
Expand Down

0 comments on commit 5eede55

Please sign in to comment.