AllenDowney / ThinkStats2

Text and supporting code for Think Stats, 2nd Edition
http://allendowney.github.io/ThinkStats2/
GNU General Public License v3.0
4.03k stars 11.31k forks source link

thinkstats2.EvalLognormalCdf TypeError #35

Closed dkandalov closed 2 years ago

dkandalov commented 8 years ago

When running thinkstats2.EvalLognormalCdf(df.income, mu=0, sigma=1) python fails with

thinkstats2.EvalLognormalCdf(df.income, mu=0, sigma=1)
  File "/path/ThinkStats2/code/thinkstats2.py", line 1895, in EvalLognormalCdf
    return stats.lognorm.cdf(x, loc=mu, scale=sigma)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/scipy/stats/distributions.py", line 1329, in cdf
    args, loc, scale = self._parse_args(*args, **kwds)
TypeError: _parse_args() takes at least 2 arguments (3 given)

If I change EvalLognormalCdf to not use named args, it seems to work, i.e. return stats.lognorm.cdf(x, mu, sigma).

AllenDowney commented 8 years ago

I will look into this as soon as I can.

Thanks!

On Thu, Feb 4, 2016 at 7:15 PM, Dmitry Kandalov notifications@github.com wrote:

When running thinkstats2EvalLognormalCdf(dfincome, mu=0, sigma=1) python fails with

thinkstats2EvalLognormalCdf(dfincome, mu=0, sigma=1) File "/path/ThinkStats2/code/thinkstats2py", line 1895, in EvalLognormalCdf return statslognormcdf(x, loc=mu, scale=sigma) File "/System/Library/Frameworks/Pythonframework/Versions/27/Extras/lib/python/scipy/stats/distributionspy", line 1329, in cdf args, loc, scale = self_parse_args(_args, *_kwds) TypeError: _parse_args() takes at least 2 arguments (3 given)

If I change EvalLognormalCdf to not use named args, it seems to work, ie return statslognormcdf(x, mu, sigma)

— Reply to this email directly or view it on GitHub https://github.com/AllenDowney/ThinkStats2/issues/35.