Skip to content

Commit cd5c2db

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ea-factorize-2
2 parents 5526398 + 7273ea0 commit cd5c2db

File tree

17 files changed

+702
-65
lines changed

17 files changed

+702
-65
lines changed

doc/source/contributing_docstring.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,18 @@ backticks. It is considered inline code:
107107
- The name of a parameter
108108
- Python code, a module, function, built-in, type, literal... (e.g. ``os``,
109109
``list``, ``numpy.abs``, ``datetime.date``, ``True``)
110-
- A pandas class (in the form ``:class:`~pandas.Series```)
110+
- A pandas class (in the form ``:class:`pandas.Series```)
111111
- A pandas method (in the form ``:meth:`pandas.Series.sum```)
112112
- A pandas function (in the form ``:func:`pandas.to_datetime```)
113113

114+
.. note::
115+
To display only the last component of the linked class, method or
116+
function, prefix it with ``~``. For example, ``:class:`~pandas.Series```
117+
will link to ``pandas.Series`` but only display the last part, ``Series``
118+
as the link text. See `Sphinx cross-referencing syntax
119+
<http://www.sphinx-doc.org/en/stable/domains.html#cross-referencing-syntax>`_
120+
for details.
121+
114122
**Good:**
115123

116124
.. code-block:: python

doc/source/whatsnew/v0.23.0.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ Other API Changes
714714
- ``pd.to_datetime('today')`` now returns a datetime, consistent with ``pd.Timestamp('today')``; previously ``pd.to_datetime('today')`` returned a ``.normalized()`` datetime (:issue:`19935`)
715715
- :func:`Series.str.replace` now takes an optional `regex` keyword which, when set to ``False``, uses literal string replacement rather than regex replacement (:issue:`16808`)
716716
- :func:`DatetimeIndex.strftime` and :func:`PeriodIndex.strftime` now return an ``Index`` instead of a numpy array to be consistent with similar accessors (:issue:`20127`)
717+
- Constructing a Series from a list of length 1 no longer broadcasts this list when a longer index is specified (:issue:`19714`, :issue:`20391`).
717718

718719
.. _whatsnew_0230.deprecations:
719720

@@ -843,6 +844,7 @@ Categorical
843844
``self`` but in a different order (:issue:`19551`)
844845
- Bug in :meth:`Index.astype` with a categorical dtype where the resultant index is not converted to a :class:`CategoricalIndex` for all types of index (:issue:`18630`)
845846
- Bug in :meth:`Series.astype` and ``Categorical.astype()`` where an existing categorical data does not get updated (:issue:`10696`, :issue:`18593`)
847+
- Bug in :meth:`Series.str.split` with ``expand=True`` incorrectly raising an IndexError on empty strings (:issue:`20002`).
846848
- Bug in :class:`Index` constructor with ``dtype=CategoricalDtype(...)`` where ``categories`` and ``ordered`` are not maintained (issue:`19032`)
847849
- Bug in :class:`Series` constructor with scalar and ``dtype=CategoricalDtype(...)`` where ``categories`` and ``ordered`` are not maintained (issue:`19565`)
848850
- Bug in ``Categorical.__iter__`` not converting to Python types (:issue:`19909`)
@@ -886,7 +888,8 @@ Timedelta
886888
- Bug in :func:`Timedelta.total_seconds()` causing precision errors i.e. ``Timedelta('30S').total_seconds()==30.000000000000004`` (:issue:`19458`)
887889
- Bug in :func: `Timedelta.__rmod__` where operating with a ``numpy.timedelta64`` returned a ``timedelta64`` object instead of a ``Timedelta`` (:issue:`19820`)
888890
- Multiplication of :class:`TimedeltaIndex` by ``TimedeltaIndex`` will now raise ``TypeError`` instead of raising ``ValueError`` in cases of length mis-match (:issue`19333`)
889-
-
891+
- Bug in indexing a :class:`TimedeltaIndex` with a ``np.timedelta64`` object which was raising a ``TypeError`` (:issue:`20393`)
892+
890893

891894
Timezones
892895
^^^^^^^^^

pandas/_libs/tslibs/period.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,7 +1355,7 @@ cdef class _Period(object):
13551355
13561356
Returns
13571357
-------
1358-
int
1358+
int
13591359
13601360
See Also
13611361
--------
@@ -1371,7 +1371,7 @@ cdef class _Period(object):
13711371
>>> p = pd.Period("2018-02-01", "D")
13721372
>>> p.week
13731373
5
1374-
1374+
13751375
>>> p = pd.Period("2018-01-06", "D")
13761376
>>> p.week
13771377
1

pandas/core/dtypes/inference.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,37 @@ def is_number(obj):
2828
"""
2929
Check if the object is a number.
3030
31+
Returns True when the object is a number, and False if is not.
32+
3133
Parameters
3234
----------
33-
obj : The object to check.
35+
obj : any type
36+
The object to check if is a number.
3437
3538
Returns
3639
-------
3740
is_number : bool
3841
Whether `obj` is a number or not.
3942
43+
See Also
44+
--------
45+
pandas.api.types.is_integer: checks a subgroup of numbers
46+
4047
Examples
4148
--------
42-
>>> is_number(1)
49+
>>> pd.api.types.is_number(1)
50+
True
51+
>>> pd.api.types.is_number(7.15)
4352
True
44-
>>> is_number("foo")
53+
54+
Booleans are valid because they are int subclass.
55+
56+
>>> pd.api.types.is_number(False)
57+
True
58+
59+
>>> pd.api.types.is_number("foo")
60+
False
61+
>>> pd.api.types.is_number("5")
4562
False
4663
"""
4764

0 commit comments

Comments
 (0)