Skip to content

Commit 9abc923

Browse files
committed
improved cross-linking in computation.rst
1 parent f44a83a commit 9abc923

File tree

1 file changed

+49
-44
lines changed

1 file changed

+49
-44
lines changed

doc/source/computation.rst

Lines changed: 49 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -212,28 +212,30 @@ mean, median, correlation, variance, covariance, standard deviation, skewness,
212212
and kurtosis. All of these methods are in the :mod:`pandas` namespace, but
213213
otherwise they can be found in :mod:`pandas.stats.moments`.
214214

215+
.. currentmodule:: pandas
216+
215217
.. csv-table::
216218
:header: "Function", "Description"
217219
:widths: 20, 80
218220

219-
``rolling_count``, Number of non-null observations
220-
``rolling_sum``, Sum of values
221-
``rolling_mean``, Mean of values
222-
``rolling_median``, Arithmetic median of values
223-
``rolling_min``, Minimum
224-
``rolling_max``, Maximum
225-
``rolling_std``, Unbiased standard deviation
226-
``rolling_var``, Unbiased variance
227-
``rolling_skew``, Unbiased skewness (3rd moment)
228-
``rolling_kurt``, Unbiased kurtosis (4th moment)
229-
``rolling_quantile``, Sample quantile (value at %)
230-
``rolling_apply``, Generic apply
231-
``rolling_cov``, Unbiased covariance (binary)
232-
``rolling_corr``, Correlation (binary)
233-
``rolling_window``, Moving window function
221+
:func:`rolling_count`, Number of non-null observations
222+
:func:`rolling_sum`, Sum of values
223+
:func:`rolling_mean`, Mean of values
224+
:func:`rolling_median`, Arithmetic median of values
225+
:func:`rolling_min`, Minimum
226+
:func:`rolling_max`, Maximum
227+
:func:`rolling_std`, Unbiased standard deviation
228+
:func:`rolling_var`, Unbiased variance
229+
:func:`rolling_skew`, Unbiased skewness (3rd moment)
230+
:func:`rolling_kurt`, Unbiased kurtosis (4th moment)
231+
:func:`rolling_quantile`, Sample quantile (value at %)
232+
:func:`rolling_apply`, Generic apply
233+
:func:`rolling_cov`, Unbiased covariance (binary)
234+
:func:`rolling_corr`, Correlation (binary)
235+
:func:`rolling_window`, Moving window function
234236

235237
Generally these methods all have the same interface. The binary operators
236-
(e.g. ``rolling_corr``) take two Series or DataFrames. Otherwise, they all
238+
(e.g. :func:`rolling_corr`) take two Series or DataFrames. Otherwise, they all
237239
accept the following arguments:
238240

239241
- ``window``: size of moving window
@@ -244,8 +246,8 @@ accept the following arguments:
244246
Note that prior to pandas v0.8.0, a keyword argument ``time_rule`` was used
245247
instead of ``freq`` that referred to the legacy time rule constants
246248
- ``how``: optionally specify method for down or re-sampling. Default is
247-
is min for ``rolling_min``, max for ``rolling_max``, median for
248-
``rolling_median``, and mean for all other rolling functions. See
249+
is min for :func:`rolling_min`, max for :func:`rolling_max`, median for
250+
:func:`rolling_median`, and mean for all other rolling functions. See
249251
:meth:`DataFrame.resample`'s how argument for more information.
250252

251253
These functions can be applied to ndarrays or Series objects:
@@ -265,7 +267,6 @@ sugar for applying the moving window operator to all of the DataFrame's columns:
265267

266268
.. ipython:: python
267269
:suppress:
268-
269270
plt.close('all')
270271
271272
.. ipython:: python
@@ -277,7 +278,7 @@ sugar for applying the moving window operator to all of the DataFrame's columns:
277278
@savefig rolling_mean_frame.png
278279
pd.rolling_sum(df, 60).plot(subplots=True)
279280
280-
The ``rolling_apply`` function takes an extra ``func`` argument and performs
281+
The :func:`rolling_apply` function takes an extra ``func`` argument and performs
281282
generic rolling computations. The ``func`` argument should be a single function
282283
that produces a single value from an ndarray input. Suppose we wanted to
283284
compute the mean absolute deviation on a rolling basis:
@@ -288,7 +289,7 @@ compute the mean absolute deviation on a rolling basis:
288289
@savefig rolling_apply_ex.png
289290
pd.rolling_apply(ts, 60, mad).plot(style='k')
290291
291-
The ``rolling_window`` function performs a generic rolling window computation
292+
The :func:`rolling_window` function performs a generic rolling window computation
292293
on the input data. The weights used in the window are specified by the ``win_type``
293294
keyword. The list of recognized types are:
294295

@@ -313,7 +314,7 @@ keyword. The list of recognized types are:
313314
314315
pd.rolling_window(ser, 5, 'triang')
315316
316-
Note that the ``boxcar`` window is equivalent to ``rolling_mean``.
317+
Note that the ``boxcar`` window is equivalent to :func:`rolling_mean`.
317318

318319
.. ipython:: python
319320
@@ -358,7 +359,7 @@ This keyword is available in other rolling functions as well.
358359
Binary rolling moments
359360
~~~~~~~~~~~~~~~~~~~~~~
360361

361-
``rolling_cov`` and ``rolling_corr`` can compute moving window statistics about
362+
:func:`rolling_cov` and :func:`rolling_corr` can compute moving window statistics about
362363
two ``Series`` or any combination of ``DataFrame/Series`` or
363364
``DataFrame/DataFrame``. Here is the behavior in each case:
364365

@@ -447,24 +448,26 @@ they are implemented in pandas such that the following two calls are equivalent:
447448
Like the ``rolling_`` functions, the following methods are included in the
448449
``pandas`` namespace or can be located in ``pandas.stats.moments``.
449450

451+
.. currentmodule:: pandas
452+
450453
.. csv-table::
451454
:header: "Function", "Description"
452455
:widths: 20, 80
453456

454-
``expanding_count``, Number of non-null observations
455-
``expanding_sum``, Sum of values
456-
``expanding_mean``, Mean of values
457-
``expanding_median``, Arithmetic median of values
458-
``expanding_min``, Minimum
459-
``expanding_max``, Maximum
460-
``expanding_std``, Unbiased standard deviation
461-
``expanding_var``, Unbiased variance
462-
``expanding_skew``, Unbiased skewness (3rd moment)
463-
``expanding_kurt``, Unbiased kurtosis (4th moment)
464-
``expanding_quantile``, Sample quantile (value at %)
465-
``expanding_apply``, Generic apply
466-
``expanding_cov``, Unbiased covariance (binary)
467-
``expanding_corr``, Correlation (binary)
457+
:func:`expanding_count`, Number of non-null observations
458+
:func:`expanding_sum`, Sum of values
459+
:func:`expanding_mean`, Mean of values
460+
:func:`expanding_median`, Arithmetic median of values
461+
:func:`expanding_min`, Minimum
462+
:func:`expanding_max`, Maximum
463+
:func:`expanding_std`, Unbiased standard deviation
464+
:func:`expanding_var`, Unbiased variance
465+
:func:`expanding_skew`, Unbiased skewness (3rd moment)
466+
:func:`expanding_kurt`, Unbiased kurtosis (4th moment)
467+
:func:`expanding_quantile`, Sample quantile (value at %)
468+
:func:`expanding_apply`, Generic apply
469+
:func:`expanding_cov`, Unbiased covariance (binary)
470+
:func:`expanding_corr`, Correlation (binary)
468471

469472
Aside from not having a ``window`` parameter, these functions have the same
470473
interfaces as their ``rolling_`` counterpart. Like above, the parameters they
@@ -489,7 +492,7 @@ all accept are:
489492
An expanding window statistic will be more stable (and less responsive) than
490493
its rolling window counterpart as the increasing window size decreases the
491494
relative impact of an individual data point. As an example, here is the
492-
``expanding_mean`` output for the previous time series dataset:
495+
:func:`expanding_mean` output for the previous time series dataset:
493496

494497
.. ipython:: python
495498
:suppress:
@@ -512,15 +515,17 @@ A related set of functions are exponentially weighted versions of several of
512515
the above statistics. A number of expanding EW (exponentially weighted)
513516
functions are provided:
514517

518+
.. currentmodule:: pandas
519+
515520
.. csv-table::
516521
:header: "Function", "Description"
517522
:widths: 20, 80
518523

519-
``ewma``, EW moving average
520-
``ewmvar``, EW moving variance
521-
``ewmstd``, EW moving standard deviation
522-
``ewmcorr``, EW moving correlation
523-
``ewmcov``, EW moving covariance
524+
:func:`ewma`, EW moving average
525+
:func:`ewmvar`, EW moving variance
526+
:func:`ewmstd`, EW moving standard deviation
527+
:func:`ewmcorr`, EW moving correlation
528+
:func:`ewmcov`, EW moving covariance
524529

525530
In general, a weighted moving average is calculated as
526531

@@ -612,7 +617,7 @@ Whereas if ``ignore_na=True``, the weighted average would be calculated as
612617
613618
\frac{(1-\alpha) \cdot 3 + 1 \cdot 5}{(1-\alpha) + 1}.
614619
615-
The ``ewmvar``, ``ewmstd``, and ``ewmcov`` functions have a ``bias`` argument,
620+
The :func:`ewmvar`, :func:`ewmstd`, and :func:`ewmcov` functions have a ``bias`` argument,
616621
specifying whether the result should contain biased or unbiased statistics.
617622
For example, if ``bias=True``, ``ewmvar(x)`` is calculated as
618623
``ewmvar(x) = ewma(x**2) - ewma(x)**2``;

0 commit comments

Comments
 (0)