Skip to content

Commit c4b4a81

Browse files
DOC: Extension whatsenw (#20533)
DOC: various warnings.
1 parent 14889f1 commit c4b4a81

File tree

6 files changed

+63
-5
lines changed

6 files changed

+63
-5
lines changed

ci/build_docs.sh

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if [ "$DOC" ]; then
2424
source activate pandas
2525

2626
mv "$TRAVIS_BUILD_DIR"/doc /tmp
27+
mv "$TRAVIS_BUILD_DIR/LICENSE" /tmp # included in the docs.
2728
cd /tmp/doc
2829

2930
echo ###############################

doc/source/api.rst

-1
Original file line numberDiff line numberDiff line change
@@ -2576,4 +2576,3 @@ objects.
25762576
generated/pandas.Series.ix
25772577
generated/pandas.Series.imag
25782578
generated/pandas.Series.real
2579-
generated/pandas.Timestamp.offset

doc/source/io.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -2263,7 +2263,7 @@ round-trippable manner.
22632263
new_df.dtypes
22642264
22652265
Please note that the literal string 'index' as the name of an :class:`Index`
2266-
is not round-trippable, nor are any names beginning with 'level_' within a
2266+
is not round-trippable, nor are any names beginning with ``'level_'`` within a
22672267
:class:`MultiIndex`. These are used by default in :func:`DataFrame.to_json` to
22682268
indicate missing values and the subsequent read cannot distinguish the intent.
22692269

doc/source/timeseries.rst

+3-2
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,9 @@ This could also potentially speed up the conversion considerably.
198198
pd.to_datetime('12-11-2010 00:00', format='%d-%m-%Y %H:%M')
199199
200200
For more information on the choices available when specifying the ``format``
201-
option, see the Python `datetime documentation
202-
<https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior`__.
201+
option, see the Python `datetime documentation`_.
202+
203+
.. _datetime documentation: https://docs.python.org/3/library/datetime.html#strftime-and-strptime-behavior
203204

204205
Assembling Datetime from Multiple DataFrame Columns
205206
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

doc/source/whatsnew/v0.23.0.txt

+57
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,63 @@ Supplying a ``CategoricalDtype`` will make the categories in each column consist
299299
df['A'].dtype
300300
df['B'].dtype
301301

302+
.. _whatsnew_023.enhancements.extension:
303+
304+
Extending Pandas with Custom Types
305+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
306+
307+
Pandas now supports storing array-like objects that aren't necessarily 1-D NumPy
308+
arrays as columns in a DataFrame or values in a Series. This allows third-party
309+
libraries to implement extensions to NumPy's types, similar to how pandas
310+
implemented categoricals, datetimes with timezones, periods, and intervals.
311+
312+
As a demonstration, we'll use cyberpandas_, which provides an ``IPArray`` type
313+
for storing ip addresses.
314+
315+
.. code-block:: ipython
316+
317+
In [1]: from cyberpandas import IPArray
318+
319+
In [2]: values = IPArray([
320+
...: 0,
321+
...: 3232235777,
322+
...: 42540766452641154071740215577757643572
323+
...: ])
324+
...:
325+
...:
326+
327+
``IPArray`` isn't a normal 1-D NumPy array, but because it's a pandas
328+
``ExtensionArray``, it can be stored properly inside pandas' containers.
329+
330+
.. code-block:: ipython
331+
332+
In [3]: ser = pd.Series(values)
333+
...:
334+
335+
In [4]: ser
336+
Out[4]:
337+
0 0.0.0.0
338+
1 192.168.1.1
339+
2 2001:db8:85a3::8a2e:370:7334
340+
dtype: ip
341+
342+
Notice that the dtype is ``ip``. The missing value semantics of the underlying
343+
array are respected:
344+
345+
In [5]: ser.isna()
346+
...:
347+
Out[5]:
348+
0 True
349+
1 False
350+
2 False
351+
dtype: bool
352+
353+
For more, see the :ref:`extension types <extending.extension-types>`
354+
documentation. If you build an extension array, publicize it on our
355+
:ref:`ecosystem page <ecosystem.extensions>`.
356+
357+
.. _cyberpandas: https://cyberpandas.readthedocs.io/en/latest/
358+
302359
.. _whatsnew_0230.enhancements.other:
303360

304361
Other Enhancements

pandas/core/series.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ def asobject(self):
468468
469469
.. deprecated :: 0.23.0
470470
471-
Use ``astype(object) instead.
471+
Use ``astype(object)`` instead.
472472
473473
*this is an internal non-public method*
474474
"""

0 commit comments

Comments
 (0)