Closed allahale closed 5 years ago
I was running through the coffee example and ran into an error. Here is the stack trace:
--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) <ipython-input-32-cc4172207ea4> in <module>() 19 alpha = 0.05 20 model = ' + '.join(coffee_design.columns) ---> 21 factorial_power = dexpy.power.f_power(model, coffee_design, sn, alpha) 22 factorial_power.pop(0) # remove intercept 23 ~/anaconda3/lib/python3.6/site-packages/dexpy/power.py in f_power(model, design, effect_size, alpha) 30 [ 95.016, 49.003, 49.003, 49.003, 49.003 ] 31 """ ---> 32 X = dmatrix(model, design) 33 residual_df = X.shape[0] - X.shape[1] 34 ~/anaconda3/lib/python3.6/site-packages/patsy/highlevel.py in dmatrix(formula_like, data, eval_env, NA_action, return_type) 289 eval_env = EvalEnvironment.capture(eval_env, reference=1) 290 (lhs, rhs) = _do_highlevel_design(formula_like, data, eval_env, --> 291 NA_action, return_type) 292 if lhs.shape[1] != 0: 293 raise PatsyError("encountered outcome variables for a model " ~/anaconda3/lib/python3.6/site-packages/patsy/highlevel.py in _do_highlevel_design(formula_like, data, eval_env, NA_action, return_type) 163 return iter([data]) 164 design_infos = _try_incr_builders(formula_like, data_iter_maker, eval_env, --> 165 NA_action) 166 if design_infos is not None: 167 return build_design_matrices(design_infos, data, ~/anaconda3/lib/python3.6/site-packages/patsy/highlevel.py in _try_incr_builders(formula_like, data_iter_maker, eval_env, NA_action) 60 "ascii-only, or else upgrade to Python 3.") 61 if isinstance(formula_like, str): ---> 62 formula_like = ModelDesc.from_formula(formula_like) 63 # fallthrough 64 if isinstance(formula_like, ModelDesc): ~/anaconda3/lib/python3.6/site-packages/patsy/desc.py in from_formula(cls, tree_or_string) 162 tree = tree_or_string 163 else: --> 164 tree = parse_formula(tree_or_string) 165 value = Evaluator().eval(tree, require_evalexpr=False) 166 assert isinstance(value, cls) ~/anaconda3/lib/python3.6/site-packages/patsy/parse_formula.py in parse_formula(code, extra_operators) 146 tree = infix_parse(_tokenize_formula(code, operator_strings), 147 operators, --> 148 _atomic_token_types) 149 if not isinstance(tree, ParseNode) or tree.type != "~": 150 tree = ParseNode("~", None, [tree], tree.origin) ~/anaconda3/lib/python3.6/site-packages/patsy/infix_parser.py in infix_parse(tokens, operators, atomic_types, trace) 208 209 want_noun = True --> 210 for token in token_source: 211 if c.trace: 212 print("Reading next token (want_noun=%r)" % (want_noun,)) ~/anaconda3/lib/python3.6/site-packages/patsy/parse_formula.py in _tokenize_formula(code, operator_strings) 92 else: 93 it.push_back((pytype, token_string, origin)) ---> 94 yield _read_python_expr(it, end_tokens) 95 96 def test__tokenize_formula(): ~/anaconda3/lib/python3.6/site-packages/patsy/parse_formula.py in _read_python_expr(it, end_tokens) 42 origins = [] 43 bracket_level = 0 ---> 44 for pytype, token_string, origin in it: 45 assert bracket_level >= 0 46 if bracket_level == 0 and token_string in end_tokens: ~/anaconda3/lib/python3.6/site-packages/patsy/util.py in next(self) 330 else: 331 # May raise StopIteration --> 332 return six.advance_iterator(self._it) 333 __next__ = next 334 ~/anaconda3/lib/python3.6/site-packages/patsy/tokens.py in python_tokenize(code) 33 break 34 origin = Origin(code, start, end) ---> 35 assert pytype not in (tokenize.NL, tokenize.NEWLINE) 36 if pytype == tokenize.ERRORTOKEN: 37 raise PatsyError("error tokenizing input " AssertionError:
Fixed by upgrading patsy to version 0.5.1
I was running through the coffee example and ran into an error. Here is the stack trace: