Skip to content

Commit

Permalink
DOC: fixes pipe example in basics.rst due to statsmodel changes (pand…
Browse files Browse the repository at this point in the history
  • Loading branch information
ccatalfo authored and jorisvandenbossche committed Feb 28, 2018
1 parent dfe9d4a commit 14a38a6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ What if the function you wish to apply takes its data as, say, the second argume
In this case, provide ``pipe`` with a tuple of ``(callable, data_keyword)``.
``.pipe`` will route the ``DataFrame`` to the argument specified in the tuple.

For example, we can fit a regression using statsmodels. Their API expects a formula first and a ``DataFrame`` as the second argument, ``data``. We pass in the function, keyword pair ``(sm.poisson, 'data')`` to ``pipe``:
For example, we can fit a regression using statsmodels. Their API expects a formula first and a ``DataFrame`` as the second argument, ``data``. We pass in the function, keyword pair ``(sm.ols, 'data')`` to ``pipe``:

.. ipython:: python
Expand All @@ -756,7 +756,7 @@ For example, we can fit a regression using statsmodels. Their API expects a form
(bb.query('h > 0')
.assign(ln_h = lambda df: np.log(df.h))
.pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
.pipe((sm.ols, 'data'), 'hr ~ ln_h + year + g + C(lg)')
.fit()
.summary()
)
Expand Down
4 changes: 2 additions & 2 deletions doc/source/whatsnew/v0.16.2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ of ``(function, keyword)`` indicating where the DataFrame should flow. For examp

bb = pd.read_csv('data/baseball.csv', index_col='id')

# sm.poisson takes (formula, data)
# sm.ols takes (formula, data)
(bb.query('h > 0')
.assign(ln_h = lambda df: np.log(df.h))
.pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
.pipe((sm.ols, 'data'), 'hr ~ ln_h + year + g + C(lg)')
.fit()
.summary()
)
Expand Down

0 comments on commit 14a38a6

Please sign in to comment.