Skip to content

Commit 54919a4

Browse files
committed
DOC: fix doc build warnings
1 parent a58ad4f commit 54919a4

11 files changed

+94
-69
lines changed

doc/source/basics.rst

+2-1
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ be broadcast:
370370
or it can return False if broadcasting can not be done:
371371

372372
.. ipython:: python
373+
:okwarning:
373374
374375
np.array([1, 2, 3]) == np.array([1, 2])
375376
@@ -1757,7 +1758,7 @@ but occasionally has non-dates intermixed and you want to represent as missing.
17571758
'foo', 1.0, 1, pd.Timestamp('20010104'),
17581759
'20010105'], dtype='O')
17591760
s
1760-
s.convert_objects(convert_dates='coerce')
1761+
pd.to_datetime(s, errors='coerce')
17611762
17621763
In addition, :meth:`~DataFrame.convert_objects` will attempt the *soft* conversion of any *object* dtypes, meaning that if all
17631764
the objects in a Series are of the same type, the Series will have that dtype.

doc/source/enhancingperf.rst

+1
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ First we're going to need to import the cython magic function to ipython (for
9898
cython versions >=0.21 you can use ``%load_ext Cython``):
9999

100100
.. ipython:: python
101+
:okwarning:
101102
102103
%load_ext cythonmagic
103104

doc/source/indexing.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,7 @@ This is the correct access method
16251625
This *can* work at times, but is not guaranteed, and so should be avoided
16261626

16271627
.. ipython:: python
1628+
:okwarning:
16281629
16291630
dfc = dfc.copy()
16301631
dfc['A'][0] = 111

doc/source/options.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ All options also have a default value, and you can use ``reset_option`` to do ju
107107
It's also possible to reset multiple options at once (using a regex):
108108

109109
.. ipython:: python
110+
:okwarning:
110111
111112
pd.reset_option("^display")
112113
@@ -499,5 +500,3 @@ Enabling ``display.unicode.ambiguous_as_wide`` lets pandas to figure these chara
499500
500501
pd.set_option('display.unicode.east_asian_width', False)
501502
pd.set_option('display.unicode.ambiguous_as_wide', False)
502-
503-

doc/source/r_interface.rst

+2
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ DataFrames into the equivalent R object (that is, **data.frame**):
136136

137137
.. ipython:: python
138138
139+
import pandas.rpy.common as com
139140
df = pd.DataFrame({'A': [1, 2, 3], 'B': [4, 5, 6], 'C':[7,8,9]},
140141
index=["one", "two", "three"])
141142
r_dataframe = com.convert_to_r_dataframe(df)
@@ -154,6 +155,7 @@ R matrices bear no information on the data type):
154155

155156
.. ipython:: python
156157
158+
import pandas.rpy.common as com
157159
r_matrix = com.convert_to_r_matrix(df)
158160
159161
print(type(r_matrix))

doc/source/text.rst

+52-51
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
randn = np.random.randn
1010
np.set_printoptions(precision=4, suppress=True)
1111
from pandas.compat import lrange
12-
options.display.max_rows=15
12+
pd.options.display.max_rows=15
1313
1414
======================
1515
Working with Text Data
@@ -375,53 +375,54 @@ Method Summary
375375
.. csv-table::
376376
:header: "Method", "Description"
377377
:widths: 20, 80
378-
379-
:meth:`~Series.str.cat`,Concatenate strings
380-
:meth:`~Series.str.split`,Split strings on delimiter
381-
:meth:`~Series.str.rsplit`,Split strings on delimiter working from the end of the string
382-
:meth:`~Series.str.get`,Index into each element (retrieve i-th element)
383-
:meth:`~Series.str.join`,Join strings in each element of the Series with passed separator
384-
:meth:`~Series.str.get_dummies`,Split strings on delimiter, returning DataFrame of dummy variables
385-
:meth:`~Series.str.contains`,Return boolean array if each string contains pattern/regex
386-
:meth:`~Series.str.replace`,Replace occurrences of pattern/regex with some other string
387-
:meth:`~Series.str.repeat`,Duplicate values (``s.str.repeat(3)`` equivalent to ``x * 3``)
388-
:meth:`~Series.str.pad`,"Add whitespace to left, right, or both sides of strings"
389-
:meth:`~Series.str.center`,Equivalent to ``str.center``
390-
:meth:`~Series.str.ljust`,Equivalent to ``str.ljust``
391-
:meth:`~Series.str.rjust`,Equivalent to ``str.rjust``
392-
:meth:`~Series.str.zfill`,Equivalent to ``str.zfill``
393-
:meth:`~Series.str.wrap`,Split long strings into lines with length less than a given width
394-
:meth:`~Series.str.slice`,Slice each string in the Series
395-
:meth:`~Series.str.slice_replace`,Replace slice in each string with passed value
396-
:meth:`~Series.str.count`,Count occurrences of pattern
397-
:meth:`~Series.str.startswith`,Equivalent to ``str.startswith(pat)`` for each element
398-
:meth:`~Series.str.endswith`,Equivalent to ``str.endswith(pat)`` for each element
399-
:meth:`~Series.str.findall`,Compute list of all occurrences of pattern/regex for each string
400-
:meth:`~Series.str.match`,"Call ``re.match`` on each element, returning matched groups as list"
401-
:meth:`~Series.str.extract`,"Call ``re.search`` on each element, returning DataFrame with one row for each element and one column for each regex capture group"
402-
:meth:`~Series.str.extractall`,"Call ``re.findall`` on each element, returning DataFrame with one row for each match and one column for each regex capture group"
403-
:meth:`~Series.str.len`,Compute string lengths
404-
:meth:`~Series.str.strip`,Equivalent to ``str.strip``
405-
:meth:`~Series.str.rstrip`,Equivalent to ``str.rstrip``
406-
:meth:`~Series.str.lstrip`,Equivalent to ``str.lstrip``
407-
:meth:`~Series.str.partition`,Equivalent to ``str.partition``
408-
:meth:`~Series.str.rpartition`,Equivalent to ``str.rpartition``
409-
:meth:`~Series.str.lower`,Equivalent to ``str.lower``
410-
:meth:`~Series.str.upper`,Equivalent to ``str.upper``
411-
:meth:`~Series.str.find`,Equivalent to ``str.find``
412-
:meth:`~Series.str.rfind`,Equivalent to ``str.rfind``
413-
:meth:`~Series.str.index`,Equivalent to ``str.index``
414-
:meth:`~Series.str.rindex`,Equivalent to ``str.rindex``
415-
:meth:`~Series.str.capitalize`,Equivalent to ``str.capitalize``
416-
:meth:`~Series.str.swapcase`,Equivalent to ``str.swapcase``
417-
:meth:`~Series.str.normalize`,Return Unicode normal form. Equivalent to ``unicodedata.normalize``
418-
:meth:`~Series.str.translate`,Equivalent to ``str.translate``
419-
:meth:`~Series.str.isalnum`,Equivalent to ``str.isalnum``
420-
:meth:`~Series.str.isalpha`,Equivalent to ``str.isalpha``
421-
:meth:`~Series.str.isdigit`,Equivalent to ``str.isdigit``
422-
:meth:`~Series.str.isspace`,Equivalent to ``str.isspace``
423-
:meth:`~Series.str.islower`,Equivalent to ``str.islower``
424-
:meth:`~Series.str.isupper`,Equivalent to ``str.isupper``
425-
:meth:`~Series.str.istitle`,Equivalent to ``str.istitle``
426-
:meth:`~Series.str.isnumeric`,Equivalent to ``str.isnumeric``
427-
:meth:`~Series.str.isdecimal`,Equivalent to ``str.isdecimal``
378+
:delim: ;
379+
380+
:meth:`~Series.str.cat`;Concatenate strings
381+
:meth:`~Series.str.split`;Split strings on delimiter
382+
:meth:`~Series.str.rsplit`;Split strings on delimiter working from the end of the string
383+
:meth:`~Series.str.get`;Index into each element (retrieve i-th element)
384+
:meth:`~Series.str.join`;Join strings in each element of the Series with passed separator
385+
:meth:`~Series.str.get_dummies`;Split strings on the delimiter returning DataFrame of dummy variables
386+
:meth:`~Series.str.contains`;Return boolean array if each string contains pattern/regex
387+
:meth:`~Series.str.replace`;Replace occurrences of pattern/regex with some other string
388+
:meth:`~Series.str.repeat`;Duplicate values (``s.str.repeat(3)`` equivalent to ``x * 3``)
389+
:meth:`~Series.str.pad`;"Add whitespace to left, right, or both sides of strings"
390+
:meth:`~Series.str.center`;Equivalent to ``str.center``
391+
:meth:`~Series.str.ljust`;Equivalent to ``str.ljust``
392+
:meth:`~Series.str.rjust`;Equivalent to ``str.rjust``
393+
:meth:`~Series.str.zfill`;Equivalent to ``str.zfill``
394+
:meth:`~Series.str.wrap`;Split long strings into lines with length less than a given width
395+
:meth:`~Series.str.slice`;Slice each string in the Series
396+
:meth:`~Series.str.slice_replace`;Replace slice in each string with passed value
397+
:meth:`~Series.str.count`;Count occurrences of pattern
398+
:meth:`~Series.str.startswith`;Equivalent to ``str.startswith(pat)`` for each element
399+
:meth:`~Series.str.endswith`;Equivalent to ``str.endswith(pat)`` for each element
400+
:meth:`~Series.str.findall`;Compute list of all occurrences of pattern/regex for each string
401+
:meth:`~Series.str.match`;"Call ``re.match`` on each element, returning matched groups as list"
402+
:meth:`~Series.str.extract`;"Call ``re.search`` on each element, returning DataFrame with one row for each element and one column for each regex capture group"
403+
:meth:`~Series.str.extractall`;"Call ``re.findall`` on each element, returning DataFrame with one row for each match and one column for each regex capture group"
404+
:meth:`~Series.str.len`;Compute string lengths
405+
:meth:`~Series.str.strip`;Equivalent to ``str.strip``
406+
:meth:`~Series.str.rstrip`;Equivalent to ``str.rstrip``
407+
:meth:`~Series.str.lstrip`;Equivalent to ``str.lstrip``
408+
:meth:`~Series.str.partition`;Equivalent to ``str.partition``
409+
:meth:`~Series.str.rpartition`;Equivalent to ``str.rpartition``
410+
:meth:`~Series.str.lower`;Equivalent to ``str.lower``
411+
:meth:`~Series.str.upper`;Equivalent to ``str.upper``
412+
:meth:`~Series.str.find`;Equivalent to ``str.find``
413+
:meth:`~Series.str.rfind`;Equivalent to ``str.rfind``
414+
:meth:`~Series.str.index`;Equivalent to ``str.index``
415+
:meth:`~Series.str.rindex`;Equivalent to ``str.rindex``
416+
:meth:`~Series.str.capitalize`;Equivalent to ``str.capitalize``
417+
:meth:`~Series.str.swapcase`;Equivalent to ``str.swapcase``
418+
:meth:`~Series.str.normalize`;Return Unicode normal form. Equivalent to ``unicodedata.normalize``
419+
:meth:`~Series.str.translate`;Equivalent to ``str.translate``
420+
:meth:`~Series.str.isalnum`;Equivalent to ``str.isalnum``
421+
:meth:`~Series.str.isalpha`;Equivalent to ``str.isalpha``
422+
:meth:`~Series.str.isdigit`;Equivalent to ``str.isdigit``
423+
:meth:`~Series.str.isspace`;Equivalent to ``str.isspace``
424+
:meth:`~Series.str.islower`;Equivalent to ``str.islower``
425+
:meth:`~Series.str.isupper`;Equivalent to ``str.isupper``
426+
:meth:`~Series.str.istitle`;Equivalent to ``str.istitle``
427+
:meth:`~Series.str.isnumeric`;Equivalent to ``str.isnumeric``
428+
:meth:`~Series.str.isdecimal`;Equivalent to ``str.isdecimal``

doc/source/whatsnew/v0.10.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ Updated PyTables Support
292292
store.select('df')
293293

294294
.. ipython:: python
295+
:okwarning:
295296

296297
wp = Panel(randn(2, 5, 4), items=['Item1', 'Item2'],
297298
major_axis=date_range('1/1/2000', periods=5),

doc/source/whatsnew/v0.15.0.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ Rolling/Expanding Moments improvements
420420

421421
New behavior
422422

423-
.. ipython:: python
423+
.. code-block:: python
424424

425425
In [10]: pd.rolling_window(s, window=3, win_type='triang', center=True)
426426
Out[10]:

doc/source/whatsnew/v0.15.1.txt

+5-6
Original file line numberDiff line numberDiff line change
@@ -110,19 +110,18 @@ API changes
110110

111111
.. code-block:: python
112112

113-
In [8]: s.loc[3.5:1.5]
114-
KeyError: 3.5
113+
In [8]: s.loc[3.5:1.5]
114+
KeyError: 3.5
115115

116116
current behavior:
117117

118118
.. ipython:: python
119119

120-
s.loc[3.5:1.5]
121-
120+
s.loc[3.5:1.5]
122121

123122
- ``io.data.Options`` has been fixed for a change in the format of the Yahoo Options page (:issue:`8612`), (:issue:`8741`)
124123

125-
.. note::
124+
.. note::
126125

127126
As a result of a change in Yahoo's option page layout, when an expiry date is given,
128127
``Options`` methods now return data for a single expiry date. Previously, methods returned all
@@ -146,6 +145,7 @@ API changes
146145
Current behavior:
147146

148147
.. ipython:: python
148+
:okwarning:
149149

150150
from pandas.io.data import Options
151151
aapl = Options('aapl','yahoo')
@@ -274,4 +274,3 @@ Bug Fixes
274274
- Bug in Setting by indexer to a scalar value with a mixed-dtype `Panel4d` was failing (:issue:`8702`)
275275
- Bug where ``DataReader``'s would fail if one of the symbols passed was invalid. Now returns data for valid symbols and np.nan for invalid (:issue:`8494`)
276276
- Bug in ``get_quote_yahoo`` that wouldn't allow non-float return values (:issue:`5229`).
277-

doc/source/whatsnew/v0.17.0.txt

+1
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ be broadcast:
723723
or it can return False if broadcasting can not be done:
724724

725725
.. ipython:: python
726+
:okwarning:
726727

727728
np.array([1, 2, 3]) == np.array([1, 2])
728729

doc/source/whatsnew/v0.18.0.txt

+27-8
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ In v0.18.0, the ``expand`` argument was added to
192192
Currently the default is ``expand=None`` which gives a ``FutureWarning`` and uses ``expand=False``. To avoid this warning, please explicitly specify ``expand``.
193193

194194
.. ipython:: python
195+
:okwarning:
195196

196197
pd.Series(['a1', 'b2', 'c3']).str.extract('[ab](\d)', expand=None)
197198

@@ -608,26 +609,25 @@ Changes to msgpack
608609

609610
Forward incompatible changes in ``msgpack`` writing format were made over 0.17.0 and 0.18.0; older versions of pandas cannot read files packed by newer versions (:issue:`12129`, `10527`)
610611

611-
Bug in ``to_msgpack`` and ``read_msgpack`` introduced in 0.17.0 and fixed in 0.18.0, caused files packed in Python 2 unreadable by Python 3 (:issue:`12142`)
612+
Bug in ``to_msgpack`` and ``read_msgpack`` introduced in 0.17.0 and fixed in 0.18.0, caused files packed in Python 2 unreadable by Python 3 (:issue:`12142`). The following table describes the backward and forward compat of msgpacks.
612613

613614
.. warning::
614615

615-
As a result of a number of issues:
616-
617616
+----------------------+------------------------+
618617
| Packed with | Can be unpacked with |
619618
+======================+========================+
620619
| pre-0.17 / Python 2 | any |
621620
+----------------------+------------------------+
622621
| pre-0.17 / Python 3 | any |
623622
+----------------------+------------------------+
624-
| 0.17 / Python 2 | - 0.17 / Python 2 |
623+
| 0.17 / Python 2 | - ==0.17 / Python 2 |
625624
| | - >=0.18 / any Python |
626625
+----------------------+------------------------+
627626
| 0.17 / Python 3 | >=0.18 / any Python |
628627
+----------------------+------------------------+
629628
| 0.18 | >= 0.18 |
630-
+======================+========================+
629+
+----------------------+------------------------+
630+
631631

632632
0.18.0 is backward-compatible for reading files packed by older versions, except for files packed with 0.17 in Python 2, in which case only they can only be unpacked in Python 2.
633633

@@ -780,7 +780,7 @@ Now, you can write ``.resample`` as a 2-stage operation like groupby, which
780780
yields a ``Resampler``.
781781

782782
.. ipython:: python
783-
783+
:okwarning:
784784

785785
r = df.resample('2s')
786786
r
@@ -872,9 +872,28 @@ in an inplace change to the ``DataFrame``. (:issue:`9297`)
872872
.. ipython:: python
873873

874874
df = pd.DataFrame({'a': np.linspace(0, 10, 5), 'b': range(5)})
875-
df.eval('c = a + b')
876875
df
877876

877+
.. ipython:: python
878+
:suppress:
879+
880+
df.eval('c = a + b', inplace=True)
881+
882+
.. code-block:: python
883+
884+
In [12]: df.eval('c = a + b')
885+
FutureWarning: eval expressions containing an assignment currentlydefault to operating inplace.
886+
This will change in a future version of pandas, use inplace=True to avoid this warning.
887+
888+
In [13]: df
889+
Out[13]:
890+
a b c
891+
0 0.0 0 0.0
892+
1 2.5 1 3.5
893+
2 5.0 2 7.0
894+
3 7.5 3 10.5
895+
4 10.0 4 14.0
896+
878897
In version 0.18.0, a new ``inplace`` keyword was added to choose whether the
879898
assignment should be done inplace or return a copy.
880899

@@ -941,7 +960,7 @@ Other API Changes
941960
- ``DataFrame.to_latex()`` now supports non-ascii encodings (eg utf-8) in Python 2 with the parameter ``encoding`` (:issue:`7061`)
942961
- ``pandas.merge()`` and ``DataFrame.merge()`` will show a specific error message when trying to merge with an object that is not of type ``DataFrame`` or a subclass (:issue:`12081`)
943962
- ``DataFrame.unstack`` and ``Series.unstack`` now take ``fill_value`` keyword to allow direct replacement of missing values when an unstack results in missing values in the resulting ``DataFrame``. As an added benefit, specifying ``fill_value`` will preserve the data type of the original stacked data. (:issue:`9746`)
944-
- As part of the new API for :ref:`window functions <whatsnew_0180.enhancements.moments>` and :ref:`resampling <whatsnew_0180.breaking.resample>`, aggregation functions have been clarified, raising more informative error messages on invalid aggregations. (:issue:`9052`). A full set of examples are presented in :ref:`groupby <groupby.aggregation>`.
963+
- As part of the new API for :ref:`window functions <whatsnew_0180.enhancements.moments>` and :ref:`resampling <whatsnew_0180.breaking.resample>`, aggregation functions have been clarified, raising more informative error messages on invalid aggregations. (:issue:`9052`). A full set of examples are presented in :ref:`groupby <groupby.aggregate>`.
945964
- Statistical functions for ``NDFrame`` objects will now raise if non-numpy-compatible arguments are passed in for ``**kwargs`` (:issue:`12301`)
946965
- ``.to_latex`` and ``.to_html`` gain a ``decimal`` parameter like ``.to_csv``; the default is ``'.'`` (:issue:`12031`)
947966
- More helpful error message when constructing a ``DataFrame`` with empty data but with indices (:issue:`8020`)

0 commit comments

Comments
 (0)