Skip to content

Commit dd89ce4

Browse files
Merge pull request #5903 from jorisvandenbossche/docs-code-snippets
DOC: remove usage of code-block directive in docstrings + fix some warnings
2 parents f4fc029 + c2c7aee commit dd89ce4

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

doc/source/ecosystem.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,22 +19,22 @@ We'd like to make it easier for users to find these project, if you know of othe
1919
substantial projects that you feel should be on this list, please let us know.
2020

2121
`Statsmodels <http://statsmodels.sourceforge.net>`__
22-
-----------
22+
----------------------------------------------------
2323

2424
Statsmodels is the prominent python "statistics and econometrics library" and it has
2525
a long-standing special relationship with pandas. Statsmodels provides powerful statistics,
2626
econometrics, analysis and modeling functionality that is out of pandas' scope.
2727
Statsmodels leverages pandas objects as the underlying data container for computation.
2828

2929
`Vincent <https://github.com/wrobstory/vincent>`__
30-
-------
30+
--------------------------------------------------
3131

3232
The `Vincent <https://github.com/wrobstory/vincent>`__ project leverages `Vega <https://github.com/trifacta/vega>`__
3333
(that in turn, leverages `d3 <http://d3js.org/>`__) to create plots . It has great support
3434
for pandas data objects.
3535

3636
`yhat/ggplot <https://github.com/yhat/ggplot>`__
37-
-----------
37+
------------------------------------------------
3838

3939
Hadley Wickham's `ggplot2 <http://ggplot2.org/>`__ is a foundational exploratory visualization package for the R language.
4040
Based on `"The Grammer of Graphics" <http://www.cs.uic.edu/~wilkinson/TheGrammarOfGraphics/GOG.html>`__ it
@@ -46,7 +46,7 @@ progressing quickly in that direction.
4646

4747

4848
`Seaborn <https://github.com/mwaskom/seaborn>`__
49-
-------
49+
------------------------------------------------
5050

5151
Although pandas has quite a bit of "just plot it" functionality built-in, visualization and
5252
in particular statistical graphics is a vast field with a long tradition and lots of ground
@@ -56,7 +56,7 @@ more advanced types of plots then those offered by pandas.
5656

5757

5858
`Geopandas <https://github.com/kjordahl/geopandas>`__
59-
---------
59+
------------------------------------------------------
6060

6161
Geopandas extends pandas data objects to include geographic information which support
6262
geometric operations. If your work entails maps and geographical coordinates, and

pandas/core/series.py

+22-15
Original file line numberDiff line numberDiff line change
@@ -2094,21 +2094,8 @@ def isin(self, values):
20942094
----------
20952095
values : list-like
20962096
The sequence of values to test. Passing in a single string will
2097-
raise a ``TypeError``:
2098-
2099-
.. code-block:: python
2100-
2101-
from pandas import Series
2102-
s = Series(list('abc'))
2103-
s.isin('a')
2104-
2105-
Instead, turn a single string into a ``list`` of one element:
2106-
2107-
.. code-block:: python
2108-
2109-
from pandas import Series
2110-
s = Series(list('abc'))
2111-
s.isin(['a'])
2097+
raise a ``TypeError``. Instead, turn a single string into a
2098+
``list`` of one element.
21122099
21132100
Returns
21142101
-------
@@ -2122,6 +2109,26 @@ def isin(self, values):
21222109
See Also
21232110
--------
21242111
pandas.DataFrame.isin
2112+
2113+
Examples
2114+
--------
2115+
2116+
>>> s = pd.Series(list('abc'))
2117+
>>> s.isin(['a', 'c', 'e'])
2118+
0 True
2119+
1 False
2120+
2 True
2121+
dtype: bool
2122+
2123+
Passing a single string as ``s.isin('a')`` will raise an error. Use
2124+
a list of one element instead:
2125+
2126+
>>> s.isin(['a'])
2127+
0 True
2128+
1 False
2129+
2 False
2130+
dtype: bool
2131+
21252132
"""
21262133
if not com.is_list_like(values):
21272134
raise TypeError("only list-like objects are allowed to be passed"

pandas/io/html.py

+8-12
Original file line numberDiff line numberDiff line change
@@ -759,20 +759,16 @@ def read_html(io, match='.+', flavor=None, header=None, index_col=None,
759759
This is a dictionary of attributes that you can pass to use to identify
760760
the table in the HTML. These are not checked for validity before being
761761
passed to lxml or Beautiful Soup. However, these attributes must be
762-
valid HTML table attributes to work correctly. For example,
763-
764-
.. code-block:: python
765-
766-
attrs = {'id': 'table'}
767-
762+
valid HTML table attributes to work correctly. For example, ::
763+
764+
attrs = {'id': 'table'}
765+
768766
is a valid attribute dictionary because the 'id' HTML tag attribute is
769767
a valid HTML attribute for *any* HTML tag as per `this document
770-
<http://www.w3.org/TR/html-markup/global-attributes.html>`__.
771-
772-
.. code-block:: python
773-
774-
attrs = {'asdf': 'table'}
775-
768+
<http://www.w3.org/TR/html-markup/global-attributes.html>`__. ::
769+
770+
attrs = {'asdf': 'table'}
771+
776772
is *not* a valid attribute dictionary because 'asdf' is not a valid
777773
HTML attribute even if it is a valid XML attribute. Valid HTML 4.01
778774
table attributes can be found `here

0 commit comments

Comments
 (0)