Skip to content

pipe example in basics.rst broken due to SciPy / statsmodels changes #19713

Closed
@TomAugspurger

Description

@TomAugspurger
AttributeErrorTraceback (most recent call last)
<ipython-input-140-7e4e9a85c845> in <module>()
      1 (bb.query('h > 0')
      2    .assign(ln_h = lambda df: np.log(df.h))
----> 3    .pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
      4    .fit()
      5    .summary()
~/miniconda3/envs/pandas/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py in summary(self, yname, xname, title, alpha, yname_list)
   2548                      ('Log-Likelihood:', None),
   2549                      ('LL-Null:', ["%#8.5g" % self.llnull]),
-> 2550                      ('LLR p-value:', ["%#6.4g" % self.llr_pvalue])
   2551                      ]
   2552 
~/miniconda3/envs/pandas/lib/python3.6/site-packages/statsmodels/tools/decorators.py in __get__(self, obj, type)
     95         if _cachedval is None:
     96             # Call the "fget" function
---> 97             _cachedval = self.fget(obj)
     98             # Set the attribute in obj
     99             # print("Setting %s in cache to %s" % (name, _cachedval))
~/miniconda3/envs/pandas/lib/python3.6/site-packages/statsmodels/discrete/discrete_model.py in llr_pvalue(self)
   2403     @cache_readonly
   2404     def llr_pvalue(self):
-> 2405         return stats.chisqprob(self.llr, self.df_model)
   2406 
   2407     @cache_readonly
AttributeError: module 'scipy.stats' has no attribute 'chisqprob'
<<<-------------------------------------------------------------------------

Just do something other than poisson. Or remove statsmodels entirely, that's not the crucial point of the example.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions