Skip to content

Commit e66c23f

Browse files
committed
fix code examples III
1 parent ca3478a commit e66c23f

File tree

2 files changed

+21
-11
lines changed

2 files changed

+21
-11
lines changed

doc/source/user_guide/groupby.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1225,7 +1225,7 @@ The dimension of the returned result can also change:
12251225
that is itself a series, and possibly upcast the result to a DataFrame:
12261226

12271227
.. ipython:: python
1228-
:okwarning:
1228+
:okwarning:
12291229
12301230
def f(x):
12311231
return pd.Series([x, x ** 2], index=["x", "x^2"])

doc/source/whatsnew/v0.10.0.rst

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -243,16 +243,26 @@ Convenience methods ``ffill`` and ``bfill`` have been added:
243243
function, that is itself a series, and possibly upcast the result to a
244244
DataFrame
245245

246-
.. ipython:: python
247-
:okwarning:
248-
249-
def f(x):
250-
return pd.Series([x, x ** 2], index=["x", "x^2"])
251-
252-
253-
s = pd.Series(np.random.rand(5))
254-
s
255-
s.apply(f)
246+
.. code-block:: python
247+
248+
>>> def f(x):
249+
... return pd.Series([x, x ** 2], index=["x", "x^2"])
250+
>>>
251+
>>> s = pd.Series(np.random.rand(5))
252+
>>> s
253+
0 0.340445
254+
1 0.984729
255+
2 0.919540
256+
3 0.037772
257+
4 0.861549
258+
dtype: float64
259+
>>> s.apply(f)
260+
x x^2
261+
0 0.340445 0.115903
262+
1 0.984729 0.969691
263+
2 0.919540 0.845555
264+
3 0.037772 0.001427
265+
4 0.861549 0.742267
256266
257267
- New API functions for working with pandas options (:issue:`2097`):
258268

0 commit comments

Comments
 (0)