Skip to content

DOC: fix doc build warnings #12545

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/source/basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ be broadcast:
or it can return False if broadcasting can not be done:

.. ipython:: python
:okwarning:

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

Expand Down Expand Up @@ -1757,7 +1758,7 @@ but occasionally has non-dates intermixed and you want to represent as missing.
'foo', 1.0, 1, pd.Timestamp('20010104'),
'20010105'], dtype='O')
s
s.convert_objects(convert_dates='coerce')
pd.to_datetime(s, errors='coerce')

In addition, :meth:`~DataFrame.convert_objects` will attempt the *soft* conversion of any *object* dtypes, meaning that if all
the objects in a Series are of the same type, the Series will have that dtype.
Expand Down
1 change: 1 addition & 0 deletions doc/source/enhancingperf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ First we're going to need to import the cython magic function to ipython (for
cython versions >=0.21 you can use ``%load_ext Cython``):

.. ipython:: python
:okwarning:

%load_ext cythonmagic

Expand Down
1 change: 1 addition & 0 deletions doc/source/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1625,6 +1625,7 @@ This is the correct access method
This *can* work at times, but is not guaranteed, and so should be avoided

.. ipython:: python
:okwarning:

dfc = dfc.copy()
dfc['A'][0] = 111
Expand Down
3 changes: 1 addition & 2 deletions doc/source/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ All options also have a default value, and you can use ``reset_option`` to do ju
It's also possible to reset multiple options at once (using a regex):

.. ipython:: python
:okwarning:

pd.reset_option("^display")

Expand Down Expand Up @@ -499,5 +500,3 @@ Enabling ``display.unicode.ambiguous_as_wide`` lets pandas to figure these chara

pd.set_option('display.unicode.east_asian_width', False)
pd.set_option('display.unicode.ambiguous_as_wide', False)


2 changes: 2 additions & 0 deletions doc/source/r_interface.rst
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ DataFrames into the equivalent R object (that is, **data.frame**):

.. ipython:: python

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

.. ipython:: python

import pandas.rpy.common as com
r_matrix = com.convert_to_r_matrix(df)

print(type(r_matrix))
Expand Down
103 changes: 52 additions & 51 deletions doc/source/text.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
randn = np.random.randn
np.set_printoptions(precision=4, suppress=True)
from pandas.compat import lrange
options.display.max_rows=15
pd.options.display.max_rows=15

======================
Working with Text Data
Expand Down Expand Up @@ -375,53 +375,54 @@ Method Summary
.. csv-table::
:header: "Method", "Description"
:widths: 20, 80

:meth:`~Series.str.cat`,Concatenate strings
:meth:`~Series.str.split`,Split strings on delimiter
:meth:`~Series.str.rsplit`,Split strings on delimiter working from the end of the string
:meth:`~Series.str.get`,Index into each element (retrieve i-th element)
:meth:`~Series.str.join`,Join strings in each element of the Series with passed separator
:meth:`~Series.str.get_dummies`,Split strings on delimiter, returning DataFrame of dummy variables
:meth:`~Series.str.contains`,Return boolean array if each string contains pattern/regex
:meth:`~Series.str.replace`,Replace occurrences of pattern/regex with some other string
:meth:`~Series.str.repeat`,Duplicate values (``s.str.repeat(3)`` equivalent to ``x * 3``)
:meth:`~Series.str.pad`,"Add whitespace to left, right, or both sides of strings"
:meth:`~Series.str.center`,Equivalent to ``str.center``
:meth:`~Series.str.ljust`,Equivalent to ``str.ljust``
:meth:`~Series.str.rjust`,Equivalent to ``str.rjust``
:meth:`~Series.str.zfill`,Equivalent to ``str.zfill``
:meth:`~Series.str.wrap`,Split long strings into lines with length less than a given width
:meth:`~Series.str.slice`,Slice each string in the Series
:meth:`~Series.str.slice_replace`,Replace slice in each string with passed value
:meth:`~Series.str.count`,Count occurrences of pattern
:meth:`~Series.str.startswith`,Equivalent to ``str.startswith(pat)`` for each element
:meth:`~Series.str.endswith`,Equivalent to ``str.endswith(pat)`` for each element
:meth:`~Series.str.findall`,Compute list of all occurrences of pattern/regex for each string
:meth:`~Series.str.match`,"Call ``re.match`` on each element, returning matched groups as list"
: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"
: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"
:meth:`~Series.str.len`,Compute string lengths
:meth:`~Series.str.strip`,Equivalent to ``str.strip``
:meth:`~Series.str.rstrip`,Equivalent to ``str.rstrip``
:meth:`~Series.str.lstrip`,Equivalent to ``str.lstrip``
:meth:`~Series.str.partition`,Equivalent to ``str.partition``
:meth:`~Series.str.rpartition`,Equivalent to ``str.rpartition``
:meth:`~Series.str.lower`,Equivalent to ``str.lower``
:meth:`~Series.str.upper`,Equivalent to ``str.upper``
:meth:`~Series.str.find`,Equivalent to ``str.find``
:meth:`~Series.str.rfind`,Equivalent to ``str.rfind``
:meth:`~Series.str.index`,Equivalent to ``str.index``
:meth:`~Series.str.rindex`,Equivalent to ``str.rindex``
:meth:`~Series.str.capitalize`,Equivalent to ``str.capitalize``
:meth:`~Series.str.swapcase`,Equivalent to ``str.swapcase``
:meth:`~Series.str.normalize`,Return Unicode normal form. Equivalent to ``unicodedata.normalize``
:meth:`~Series.str.translate`,Equivalent to ``str.translate``
:meth:`~Series.str.isalnum`,Equivalent to ``str.isalnum``
:meth:`~Series.str.isalpha`,Equivalent to ``str.isalpha``
:meth:`~Series.str.isdigit`,Equivalent to ``str.isdigit``
:meth:`~Series.str.isspace`,Equivalent to ``str.isspace``
:meth:`~Series.str.islower`,Equivalent to ``str.islower``
:meth:`~Series.str.isupper`,Equivalent to ``str.isupper``
:meth:`~Series.str.istitle`,Equivalent to ``str.istitle``
:meth:`~Series.str.isnumeric`,Equivalent to ``str.isnumeric``
:meth:`~Series.str.isdecimal`,Equivalent to ``str.isdecimal``
:delim: ;

:meth:`~Series.str.cat`;Concatenate strings
:meth:`~Series.str.split`;Split strings on delimiter
:meth:`~Series.str.rsplit`;Split strings on delimiter working from the end of the string
:meth:`~Series.str.get`;Index into each element (retrieve i-th element)
:meth:`~Series.str.join`;Join strings in each element of the Series with passed separator
:meth:`~Series.str.get_dummies`;Split strings on the delimiter returning DataFrame of dummy variables
:meth:`~Series.str.contains`;Return boolean array if each string contains pattern/regex
:meth:`~Series.str.replace`;Replace occurrences of pattern/regex with some other string
:meth:`~Series.str.repeat`;Duplicate values (``s.str.repeat(3)`` equivalent to ``x * 3``)
:meth:`~Series.str.pad`;"Add whitespace to left, right, or both sides of strings"
:meth:`~Series.str.center`;Equivalent to ``str.center``
:meth:`~Series.str.ljust`;Equivalent to ``str.ljust``
:meth:`~Series.str.rjust`;Equivalent to ``str.rjust``
:meth:`~Series.str.zfill`;Equivalent to ``str.zfill``
:meth:`~Series.str.wrap`;Split long strings into lines with length less than a given width
:meth:`~Series.str.slice`;Slice each string in the Series
:meth:`~Series.str.slice_replace`;Replace slice in each string with passed value
:meth:`~Series.str.count`;Count occurrences of pattern
:meth:`~Series.str.startswith`;Equivalent to ``str.startswith(pat)`` for each element
:meth:`~Series.str.endswith`;Equivalent to ``str.endswith(pat)`` for each element
:meth:`~Series.str.findall`;Compute list of all occurrences of pattern/regex for each string
:meth:`~Series.str.match`;"Call ``re.match`` on each element, returning matched groups as list"
: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"
: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"
:meth:`~Series.str.len`;Compute string lengths
:meth:`~Series.str.strip`;Equivalent to ``str.strip``
:meth:`~Series.str.rstrip`;Equivalent to ``str.rstrip``
:meth:`~Series.str.lstrip`;Equivalent to ``str.lstrip``
:meth:`~Series.str.partition`;Equivalent to ``str.partition``
:meth:`~Series.str.rpartition`;Equivalent to ``str.rpartition``
:meth:`~Series.str.lower`;Equivalent to ``str.lower``
:meth:`~Series.str.upper`;Equivalent to ``str.upper``
:meth:`~Series.str.find`;Equivalent to ``str.find``
:meth:`~Series.str.rfind`;Equivalent to ``str.rfind``
:meth:`~Series.str.index`;Equivalent to ``str.index``
:meth:`~Series.str.rindex`;Equivalent to ``str.rindex``
:meth:`~Series.str.capitalize`;Equivalent to ``str.capitalize``
:meth:`~Series.str.swapcase`;Equivalent to ``str.swapcase``
:meth:`~Series.str.normalize`;Return Unicode normal form. Equivalent to ``unicodedata.normalize``
:meth:`~Series.str.translate`;Equivalent to ``str.translate``
:meth:`~Series.str.isalnum`;Equivalent to ``str.isalnum``
:meth:`~Series.str.isalpha`;Equivalent to ``str.isalpha``
:meth:`~Series.str.isdigit`;Equivalent to ``str.isdigit``
:meth:`~Series.str.isspace`;Equivalent to ``str.isspace``
:meth:`~Series.str.islower`;Equivalent to ``str.islower``
:meth:`~Series.str.isupper`;Equivalent to ``str.isupper``
:meth:`~Series.str.istitle`;Equivalent to ``str.istitle``
:meth:`~Series.str.isnumeric`;Equivalent to ``str.isnumeric``
:meth:`~Series.str.isdecimal`;Equivalent to ``str.isdecimal``
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.10.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ Updated PyTables Support
store.select('df')

.. ipython:: python
:okwarning:

wp = Panel(randn(2, 5, 4), items=['Item1', 'Item2'],
major_axis=date_range('1/1/2000', periods=5),
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.15.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ Rolling/Expanding Moments improvements

New behavior

.. ipython:: python
.. code-block:: python

In [10]: pd.rolling_window(s, window=3, win_type='triang', center=True)
Out[10]:
Expand Down
11 changes: 5 additions & 6 deletions doc/source/whatsnew/v0.15.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,19 +110,18 @@ API changes

.. code-block:: python

In [8]: s.loc[3.5:1.5]
KeyError: 3.5
In [8]: s.loc[3.5:1.5]
KeyError: 3.5

current behavior:

.. ipython:: python

s.loc[3.5:1.5]

s.loc[3.5:1.5]

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

.. note::
.. note::

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

.. ipython:: python
:okwarning:

from pandas.io.data import Options
aapl = Options('aapl','yahoo')
Expand Down Expand Up @@ -274,4 +274,3 @@ Bug Fixes
- Bug in Setting by indexer to a scalar value with a mixed-dtype `Panel4d` was failing (:issue:`8702`)
- 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`)
- Bug in ``get_quote_yahoo`` that wouldn't allow non-float return values (:issue:`5229`).

1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.17.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -723,6 +723,7 @@ be broadcast:
or it can return False if broadcasting can not be done:

.. ipython:: python
:okwarning:

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

Expand Down
35 changes: 27 additions & 8 deletions doc/source/whatsnew/v0.18.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ In v0.18.0, the ``expand`` argument was added to
Currently the default is ``expand=None`` which gives a ``FutureWarning`` and uses ``expand=False``. To avoid this warning, please explicitly specify ``expand``.

.. ipython:: python
:okwarning:

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

Expand Down Expand Up @@ -608,26 +609,25 @@ Changes to msgpack

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`)

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`)
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.

.. warning::

As a result of a number of issues:

+----------------------+------------------------+
| Packed with | Can be unpacked with |
+======================+========================+
| pre-0.17 / Python 2 | any |
+----------------------+------------------------+
| pre-0.17 / Python 3 | any |
+----------------------+------------------------+
| 0.17 / Python 2 | - 0.17 / Python 2 |
| 0.17 / Python 2 | - ==0.17 / Python 2 |
| | - >=0.18 / any Python |
+----------------------+------------------------+
| 0.17 / Python 3 | >=0.18 / any Python |
+----------------------+------------------------+
| 0.18 | >= 0.18 |
+======================+========================+
+----------------------+------------------------+


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.

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

.. ipython:: python

:okwarning:

r = df.resample('2s')
r
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not give a warning?

Expand Down Expand Up @@ -872,9 +872,28 @@ in an inplace change to the ``DataFrame``. (:issue:`9297`)
.. ipython:: python

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

.. ipython:: python
:suppress:

df.eval('c = a + b', inplace=True)

.. code-block:: python

In [12]: df.eval('c = a + b')
FutureWarning: eval expressions containing an assignment currentlydefault to operating inplace.
This will change in a future version of pandas, use inplace=True to avoid this warning.

In [13]: df
Out[13]:
a b c
0 0.0 0 0.0
1 2.5 1 3.5
2 5.0 2 7.0
3 7.5 3 10.5
4 10.0 4 14.0

In version 0.18.0, a new ``inplace`` keyword was added to choose whether the
assignment should be done inplace or return a copy.

Expand Down Expand Up @@ -941,7 +960,7 @@ Other API Changes
- ``DataFrame.to_latex()`` now supports non-ascii encodings (eg utf-8) in Python 2 with the parameter ``encoding`` (:issue:`7061`)
- ``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`)
- ``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`)
- 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>`.
- 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>`.
- Statistical functions for ``NDFrame`` objects will now raise if non-numpy-compatible arguments are passed in for ``**kwargs`` (:issue:`12301`)
- ``.to_latex`` and ``.to_html`` gain a ``decimal`` parameter like ``.to_csv``; the default is ``'.'`` (:issue:`12031`)
- More helpful error message when constructing a ``DataFrame`` with empty data but with indices (:issue:`8020`)
Expand Down