Skip to content

Commit df25c00

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into no-values
2 parents ed9ba9d + 871e3af commit df25c00

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+464
-329
lines changed

doc/source/development/contributing_docstring.rst

+30-30
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Also, it is a common practice to generate online (html) documentation
1717
automatically from docstrings. `Sphinx <https://www.sphinx-doc.org>`_ serves
1818
this purpose.
1919

20-
Next example gives an idea on how a docstring looks like:
20+
The next example gives an idea of what a docstring looks like:
2121

2222
.. code-block:: python
2323
@@ -26,8 +26,8 @@ Next example gives an idea on how a docstring looks like:
2626
Add up two integer numbers.
2727
2828
This function simply wraps the `+` operator, and does not
29-
do anything interesting, except for illustrating what is
30-
the docstring of a very simple function.
29+
do anything interesting, except for illustrating what
30+
the docstring of a very simple function looks like.
3131
3232
Parameters
3333
----------
@@ -56,14 +56,14 @@ Next example gives an idea on how a docstring looks like:
5656
"""
5757
return num1 + num2
5858
59-
Some standards exist about docstrings, so they are easier to read, and they can
60-
be exported to other formats such as html or pdf.
59+
Some standards regarding docstrings exist, which make them easier to read, and allow them
60+
be easily exported to other formats such as html or pdf.
6161

6262
The first conventions every Python docstring should follow are defined in
6363
`PEP-257 <https://www.python.org/dev/peps/pep-0257/>`_.
6464

65-
As PEP-257 is quite open, and some other standards exist on top of it. In the
66-
case of pandas, the numpy docstring convention is followed. The conventions is
65+
As PEP-257 is quite broad, other more specific standards also exist. In the
66+
case of pandas, the numpy docstring convention is followed. These conventions are
6767
explained in this document:
6868

6969
* `numpydoc docstring guide <https://numpydoc.readthedocs.io/en/latest/format.html>`_
@@ -83,8 +83,8 @@ about reStructuredText can be found in:
8383
pandas has some helpers for sharing docstrings between related classes, see
8484
:ref:`docstring.sharing`.
8585

86-
The rest of this document will summarize all the above guides, and will
87-
provide additional convention specific to the pandas project.
86+
The rest of this document will summarize all the above guidelines, and will
87+
provide additional conventions specific to the pandas project.
8888

8989
.. _docstring.tutorial:
9090

@@ -101,9 +101,9 @@ left before or after the docstring. The text starts in the next line after the
101101
opening quotes. The closing quotes have their own line
102102
(meaning that they are not at the end of the last sentence).
103103

104-
In rare occasions reST styles like bold text or italics will be used in
104+
On rare occasions reST styles like bold text or italics will be used in
105105
docstrings, but is it common to have inline code, which is presented between
106-
backticks. It is considered inline code:
106+
backticks. The following are considered inline code:
107107

108108
* The name of a parameter
109109
* Python code, a module, function, built-in, type, literal... (e.g. ``os``,
@@ -235,8 +235,8 @@ The extended summary provides details on what the function does. It should not
235235
go into the details of the parameters, or discuss implementation notes, which
236236
go in other sections.
237237

238-
A blank line is left between the short summary and the extended summary. And
239-
every paragraph in the extended summary is finished by a dot.
238+
A blank line is left between the short summary and the extended summary.
239+
Every paragraph in the extended summary ends with a dot.
240240

241241
The extended summary should provide details on why the function is useful and
242242
their use cases, if it is not too generic.
@@ -542,19 +542,19 @@ first (not an alias like ``np``). If the function is in a module which is not
542542
the main one, like ``scipy.sparse``, list the full module (e.g.
543543
``scipy.sparse.coo_matrix``).
544544

545-
This section, as the previous, also has a header, "See Also" (note the capital
546-
S and A). Also followed by the line with hyphens, and preceded by a blank line.
545+
This section has a header, "See Also" (note the capital
546+
S and A), followed by the line with hyphens and preceded by a blank line.
547547

548548
After the header, we will add a line for each related method or function,
549549
followed by a space, a colon, another space, and a short description that
550-
illustrated what this method or function does, why is it relevant in this
551-
context, and what are the key differences between the documented function and
552-
the one referencing. The description must also finish with a dot.
550+
illustrates what this method or function does, why is it relevant in this
551+
context, and what the key differences are between the documented function and
552+
the one being referenced. The description must also end with a dot.
553553

554-
Note that in "Returns" and "Yields", the description is located in the
555-
following line than the type. But in this section it is located in the same
556-
line, with a colon in between. If the description does not fit in the same
557-
line, it can continue in the next ones, but it has to be indented in them.
554+
Note that in "Returns" and "Yields", the description is located on the line
555+
after the type. In this section, however, it is located on the same
556+
line, with a colon in between. If the description does not fit on the same
557+
line, it can continue onto other lines which must be further indented.
558558

559559
For example:
560560

@@ -587,7 +587,7 @@ Section 6: Notes
587587
~~~~~~~~~~~~~~~~
588588

589589
This is an optional section used for notes about the implementation of the
590-
algorithm. Or to document technical aspects of the function behavior.
590+
algorithm, or to document technical aspects of the function behavior.
591591

592592
Feel free to skip it, unless you are familiar with the implementation of the
593593
algorithm, or you discover some counter-intuitive behavior while writing the
@@ -600,15 +600,15 @@ This section follows the same format as the extended summary section.
600600
Section 7: Examples
601601
~~~~~~~~~~~~~~~~~~~
602602

603-
This is one of the most important sections of a docstring, even if it is
604-
placed in the last position. As often, people understand concepts better
605-
with examples, than with accurate explanations.
603+
This is one of the most important sections of a docstring, despite being
604+
placed in the last position, as often people understand concepts better
605+
by example than through accurate explanations.
606606

607607
Examples in docstrings, besides illustrating the usage of the function or
608-
method, must be valid Python code, that in a deterministic way returns the
609-
presented output, and that can be copied and run by users.
608+
method, must be valid Python code, that returns the given output in a
609+
deterministic way, and that can be copied and run by users.
610610

611-
They are presented as a session in the Python terminal. `>>>` is used to
611+
Examples are presented as a session in the Python terminal. `>>>` is used to
612612
present code. `...` is used for code continuing from the previous line.
613613
Output is presented immediately after the last line of code generating the
614614
output (no blank lines in between). Comments describing the examples can
@@ -636,7 +636,7 @@ A simple example could be:
636636
Return the first elements of the Series.
637637
638638
This function is mainly useful to preview the values of the
639-
Series without displaying the whole of it.
639+
Series without displaying all of it.
640640
641641
Parameters
642642
----------

doc/source/whatsnew/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 1.0
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v1.0.3
2728
v1.0.2
2829
v1.0.1
2930
v1.0.0

doc/source/whatsnew/v1.0.2.rst

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Fixed regressions
1717

1818
**Groupby**
1919

20-
- Fixed regression in :meth:`groupby(..).agg() <pandas.core.groupby.GroupBy.agg>` which was failing on frames with MultiIndex columns and a custom function (:issue:`31777`)
20+
- Fixed regression in :meth:`groupby(..).agg() <pandas.core.groupby.GroupBy.agg>` which was failing on frames with :class:`MultiIndex` columns and a custom function (:issue:`31777`)
2121
- Fixed regression in ``groupby(..).rolling(..).apply()`` (``RollingGroupby``) where the ``raw`` parameter was ignored (:issue:`31754`)
2222
- Fixed regression in :meth:`rolling(..).corr() <pandas.core.window.rolling.Rolling.corr>` when using a time offset (:issue:`31789`)
2323
- Fixed regression in :meth:`groupby(..).nunique() <pandas.core.groupby.DataFrameGroupBy.nunique>` which was modifying the original values if ``NaN`` values were present (:issue:`31950`)
@@ -33,7 +33,7 @@ Fixed regressions
3333

3434
**Reindexing/alignment**
3535

36-
- Fixed regression in :meth:`Series.align` when ``other`` is a DataFrame and ``method`` is not None (:issue:`31785`)
36+
- Fixed regression in :meth:`Series.align` when ``other`` is a :class:`DataFrame` and ``method`` is not ``None`` (:issue:`31785`)
3737
- Fixed regression in :meth:`DataFrame.reindex` and :meth:`Series.reindex` when reindexing with (tz-aware) index and ``method=nearest`` (:issue:`26683`)
3838
- Fixed regression in :meth:`DataFrame.reindex_like` on a :class:`DataFrame` subclass raised an ``AssertionError`` (:issue:`31925`)
3939
- Fixed regression in :class:`DataFrame` arithmetic operations with mis-matched columns (:issue:`31623`)
@@ -81,7 +81,7 @@ Bug fixes
8181

8282
**Datetimelike**
8383

84-
- Bug in :meth:`Series.astype` not copying for tz-naive and tz-aware datetime64 dtype (:issue:`32490`)
84+
- Bug in :meth:`Series.astype` not copying for tz-naive and tz-aware ``datetime64`` dtype (:issue:`32490`)
8585
- Bug where :func:`to_datetime` would raise when passed ``pd.NA`` (:issue:`32213`)
8686
- Improved error message when subtracting two :class:`Timestamp` that result in an out-of-bounds :class:`Timedelta` (:issue:`31774`)
8787

@@ -122,4 +122,4 @@ Bug fixes
122122
Contributors
123123
~~~~~~~~~~~~
124124

125-
.. contributors:: v1.0.1..v1.0.2|HEAD
125+
.. contributors:: v1.0.1..v1.0.2

doc/source/whatsnew/v1.0.3.rst

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
2+
.. _whatsnew_103:
3+
4+
What's new in 1.0.3 (March ??, 2020)
5+
------------------------------------
6+
7+
These are the changes in pandas 1.0.3. See :ref:`release` for a full changelog
8+
including other versions of pandas.
9+
10+
{{ header }}
11+
12+
.. ---------------------------------------------------------------------------
13+
14+
.. _whatsnew_103.regressions:
15+
16+
Fixed regressions
17+
~~~~~~~~~~~~~~~~~
18+
19+
.. _whatsnew_103.bug_fixes:
20+
21+
Bug fixes
22+
~~~~~~~~~
23+
24+
Contributors
25+
~~~~~~~~~~~~
26+
27+
.. contributors:: v1.0.2..v1.0.3|HEAD

doc/source/whatsnew/v1.1.0.rst

+10-4
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ Categorical
238238
- Bug where :func:`merge` was unable to join on non-unique categorical indices (:issue:`28189`)
239239
- Bug when passing categorical data to :class:`Index` constructor along with ``dtype=object`` incorrectly returning a :class:`CategoricalIndex` instead of object-dtype :class:`Index` (:issue:`32167`)
240240
- Bug where :class:`Categorical` comparison operator ``__ne__`` would incorrectly evaluate to ``False`` when either element was missing (:issue:`32276`)
241-
-
241+
- :meth:`Categorical.fillna` now accepts :class:`Categorical` ``other`` argument (:issue:`32420`)
242242

243243
Datetimelike
244244
^^^^^^^^^^^^
@@ -268,6 +268,8 @@ Numeric
268268
^^^^^^^
269269
- Bug in :meth:`DataFrame.floordiv` with ``axis=0`` not treating division-by-zero like :meth:`Series.floordiv` (:issue:`31271`)
270270
- Bug in :meth:`to_numeric` with string argument ``"uint64"`` and ``errors="coerce"`` silently fails (:issue:`32394`)
271+
- Bug in :meth:`to_numeric` with ``downcast="unsigned"`` fails for empty data (:issue:`32493`)
272+
- Bug in :meth:`DataFrame.mean` with ``numeric_only=False`` and either ``datetime64`` dtype or ``PeriodDtype`` column incorrectly raising ``TypeError`` (:issue:`32426`)
271273
-
272274

273275
Conversion
@@ -303,8 +305,8 @@ Indexing
303305
Missing
304306
^^^^^^^
305307

306-
-
307-
-
308+
- Calling :meth:`fillna` on an empty Series now correctly returns a shallow copied object. The behaviour is now consistent with :class:`Index`, :class:`DataFrame` and a non-empty :class:`Series` (:issue:`32543`).
309+
308310

309311
MultiIndex
310312
^^^^^^^^^^
@@ -338,8 +340,10 @@ I/O
338340
timestamps with ``version="2.0"`` (:issue:`31652`).
339341
- Bug in :meth:`read_csv` was raising `TypeError` when `sep=None` was used in combination with `comment` keyword (:issue:`31396`)
340342
- Bug in :class:`HDFStore` that caused it to set to ``int64`` the dtype of a ``datetime64`` column when reading a DataFrame in Python 3 from fixed format written in Python 2 (:issue:`31750`)
343+
- :func:`read_csv` will raise a ``ValueError`` when the column names passed in `parse_dates` are missing in the Dataframe (:issue:`31251`)
341344
- Bug in :meth:`read_excel` where a UTF-8 string with a high surrogate would cause a segmentation violation (:issue:`23809`)
342345
- Bug in :meth:`read_csv` was causing a file descriptor leak on an empty file (:issue:`31488`)
346+
- Bug in :meth:`read_csv` was causing a segfault when there were blank lines between the header and data rows (:issue:`28071`)
343347

344348

345349
Plotting
@@ -375,7 +379,7 @@ Reshaping
375379

376380
Sparse
377381
^^^^^^
378-
382+
- Creating a :class:`SparseArray` from timezone-aware dtype will issue a warning before dropping timezone information, instead of doing so silently (:issue:`32501`)
379383
-
380384
-
381385

@@ -393,6 +397,8 @@ Other
393397
- Set operations on an object-dtype :class:`Index` now always return object-dtype results (:issue:`31401`)
394398
- Bug in :meth:`AbstractHolidayCalendar.holidays` when no rules were defined (:issue:`31415`)
395399
- Bug in :meth:`DataFrame.to_records` incorrectly losing timezone information in timezone-aware ``datetime64`` columns (:issue:`32535`)
400+
- Fixed :func:`pandas.testing.assert_series_equal` to correctly raise if left object is a different subclass with ``check_series_type=True`` (:issue:`32670`).
401+
- :meth:`IntegerArray.astype` now supports ``datetime64`` dtype (:issue:32538`)
396402

397403
.. ---------------------------------------------------------------------------
398404

pandas/_libs/lib.pyx

-14
Original file line numberDiff line numberDiff line change
@@ -94,20 +94,6 @@ cdef:
9494
float64_t NaN = <float64_t>np.NaN
9595

9696

97-
def values_from_object(obj: object):
98-
"""
99-
Return my values or the object if we are say an ndarray.
100-
"""
101-
func: object
102-
103-
func = getattr(obj, '_internal_get_values', None)
104-
if func is not None:
105-
# Includes DataFrame, for which we get frame.values
106-
obj = func()
107-
108-
return obj
109-
110-
11197
@cython.wraparound(False)
11298
@cython.boundscheck(False)
11399
def memory_usage_of_objects(arr: object[:]) -> int64_t:

0 commit comments

Comments
 (0)