Skip to content

Commit 14a38a6

Browse files
ccatalfojorisvandenbossche
authored andcommitted
DOC: fixes pipe example in basics.rst due to statsmodel changes (#19923)
1 parent dfe9d4a commit 14a38a6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

doc/source/basics.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,7 @@ What if the function you wish to apply takes its data as, say, the second argume
746746
In this case, provide ``pipe`` with a tuple of ``(callable, data_keyword)``.
747747
``.pipe`` will route the ``DataFrame`` to the argument specified in the tuple.
748748

749-
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``:
749+
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``:
750750

751751
.. ipython:: python
752752
@@ -756,7 +756,7 @@ For example, we can fit a regression using statsmodels. Their API expects a form
756756
757757
(bb.query('h > 0')
758758
.assign(ln_h = lambda df: np.log(df.h))
759-
.pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
759+
.pipe((sm.ols, 'data'), 'hr ~ ln_h + year + g + C(lg)')
760760
.fit()
761761
.summary()
762762
)

doc/source/whatsnew/v0.16.2.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ of ``(function, keyword)`` indicating where the DataFrame should flow. For examp
6363

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

66-
# sm.poisson takes (formula, data)
66+
# sm.ols takes (formula, data)
6767
(bb.query('h > 0')
6868
.assign(ln_h = lambda df: np.log(df.h))
69-
.pipe((sm.poisson, 'data'), 'hr ~ ln_h + year + g + C(lg)')
69+
.pipe((sm.ols, 'data'), 'hr ~ ln_h + year + g + C(lg)')
7070
.fit()
7171
.summary()
7272
)

0 commit comments

Comments
 (0)