Skip to content

Commit 01f01fd

Browse files
committed
Merge remote-tracking branch 'remotes/upstream/master' into issue-32395
2 parents 00199f6 + 7b032ec commit 01f01fd

30 files changed

+428
-228
lines changed

ci/code_checks.sh

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -266,57 +266,66 @@ fi
266266
### DOCTESTS ###
267267
if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
268268

269+
# Individual files
270+
271+
MSG='Doctests base.py' ; echo $MSG
272+
pytest -q --doctest-modules pandas/core/base.py
273+
RET=$(($RET + $?)) ; echo $MSG "DONE"
274+
275+
MSG='Doctests construction.py' ; echo $MSG
276+
pytest -q --doctest-modules pandas/core/construction.py
277+
RET=$(($RET + $?)) ; echo $MSG "DONE"
278+
269279
MSG='Doctests frame.py' ; echo $MSG
270280
pytest -q --doctest-modules pandas/core/frame.py
271281
RET=$(($RET + $?)) ; echo $MSG "DONE"
272282

273-
MSG='Doctests series.py' ; echo $MSG
274-
pytest -q --doctest-modules pandas/core/series.py
283+
MSG='Doctests generic.py' ; echo $MSG
284+
pytest -q --doctest-modules pandas/core/generic.py
275285
RET=$(($RET + $?)) ; echo $MSG "DONE"
276286

277287
MSG='Doctests groupby.py' ; echo $MSG
278288
pytest -q --doctest-modules pandas/core/groupby/groupby.py -k"-cumcount -describe -pipe"
279289
RET=$(($RET + $?)) ; echo $MSG "DONE"
280290

281-
MSG='Doctests tools' ; echo $MSG
282-
pytest -q --doctest-modules pandas/core/tools/
291+
MSG='Doctests series.py' ; echo $MSG
292+
pytest -q --doctest-modules pandas/core/series.py
283293
RET=$(($RET + $?)) ; echo $MSG "DONE"
284294

285-
MSG='Doctests reshaping functions' ; echo $MSG
286-
pytest -q --doctest-modules pandas/core/reshape/
287-
RET=$(($RET + $?)) ; echo $MSG "DONE"
288-
289-
MSG='Doctests interval classes' ; echo $MSG
290-
pytest -q --doctest-modules pandas/core/indexes/interval.py
291-
RET=$(($RET + $?)) ; echo $MSG "DONE"
295+
# Directories
292296

293297
MSG='Doctests arrays'; echo $MSG
294298
pytest -q --doctest-modules pandas/core/arrays/
295299
RET=$(($RET + $?)) ; echo $MSG "DONE"
296300

301+
MSG='Doctests computation' ; echo $MSG
302+
pytest -q --doctest-modules pandas/core/computation/
303+
RET=$(($RET + $?)) ; echo $MSG "DONE"
304+
297305
MSG='Doctests dtypes'; echo $MSG
298306
pytest -q --doctest-modules pandas/core/dtypes/
299307
RET=$(($RET + $?)) ; echo $MSG "DONE"
300308

301-
MSG='Doctests base.py' ; echo $MSG
302-
pytest -q --doctest-modules pandas/core/base.py
309+
MSG='Doctests indexes' ; echo $MSG
310+
pytest -q --doctest-modules pandas/core/indexes/
303311
RET=$(($RET + $?)) ; echo $MSG "DONE"
304312

305-
MSG='Doctests construction.py' ; echo $MSG
306-
pytest -q --doctest-modules pandas/core/construction.py
313+
MSG='Doctests ops' ; echo $MSG
314+
pytest -q --doctest-modules pandas/core/ops/
307315
RET=$(($RET + $?)) ; echo $MSG "DONE"
308316

309-
MSG='Doctests generic.py' ; echo $MSG
310-
pytest -q --doctest-modules pandas/core/generic.py
317+
MSG='Doctests reshape' ; echo $MSG
318+
pytest -q --doctest-modules pandas/core/reshape/
319+
RET=$(($RET + $?)) ; echo $MSG "DONE"
320+
321+
MSG='Doctests tools' ; echo $MSG
322+
pytest -q --doctest-modules pandas/core/tools/
311323
RET=$(($RET + $?)) ; echo $MSG "DONE"
312324

313325
MSG='Doctests tseries' ; echo $MSG
314326
pytest -q --doctest-modules pandas/tseries/
315327
RET=$(($RET + $?)) ; echo $MSG "DONE"
316328

317-
MSG='Doctests computation' ; echo $MSG
318-
pytest -q --doctest-modules pandas/core/computation/
319-
RET=$(($RET + $?)) ; echo $MSG "DONE"
320329
fi
321330

322331
### DOCSTRINGS ###
@@ -327,7 +336,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
327336
RET=$(($RET + $?)) ; echo $MSG "DONE"
328337

329338
MSG='Validate correct capitalization among titles in documentation' ; echo $MSG
330-
$BASE_DIR/scripts/validate_rst_title_capitalization.py $BASE_DIR/doc/source/development/contributing.rst
339+
$BASE_DIR/scripts/validate_rst_title_capitalization.py $BASE_DIR/doc/source/development/contributing.rst $BASE_DIR/doc/source/reference
331340
RET=$(($RET + $?)) ; echo $MSG "DONE"
332341

333342
fi

doc/source/development/code_style.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ consistent code format throughout the project. For details see the
1818
Patterns
1919
========
2020

21-
foo.__class__
22-
-------------
21+
Using foo.__class__
22+
-------------------
2323

2424

2525
pandas uses 'type(foo)' instead 'foo.__class__' as it is making the code more
@@ -47,8 +47,8 @@ String formatting
4747
Concatenated strings
4848
--------------------
4949

50-
f-strings
51-
~~~~~~~~~
50+
Using f-strings
51+
~~~~~~~~~~~~~~~
5252

5353
pandas uses f-strings formatting instead of '%' and '.format()' string formatters.
5454

doc/source/development/contributing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ Below is a brief overview on how to set-up a virtual environment with Powershell
295295
under Windows. For details please refer to the
296296
`official virtualenv user guide <https://virtualenv.pypa.io/en/stable/userguide/#activate-script>`__
297297

298-
Use an ENV_DIR of your choice. We'll use ~\virtualenvs\pandas-dev where
298+
Use an ENV_DIR of your choice. We'll use ~\\virtualenvs\\pandas-dev where
299299
'~' is the folder pointed to by either $env:USERPROFILE (Powershell) or
300300
%USERPROFILE% (cmd.exe) environment variable. Any parent directories
301301
should already exist.

doc/source/development/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ and comments contain guidance for properly implementing the interface.
139139

140140
.. _extending.extension.operator:
141141

142-
:class:`~pandas.api.extensions.ExtensionArray` Operator Support
142+
:class:`~pandas.api.extensions.ExtensionArray` operator support
143143
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
144144

145145
.. versionadded:: 0.24.0

doc/source/development/policies.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Policies
66

77
.. _policies.version:
88

9-
Version Policy
9+
Version policy
1010
~~~~~~~~~~~~~~
1111

1212
.. versionchanged:: 1.0.0
@@ -48,7 +48,7 @@ deprecation removed in the next next major release (2.0.0).
4848
These policies do not apply to features marked as **experimental** in the documentation.
4949
pandas may change the behavior of experimental features at any time.
5050

51-
Python Support
51+
Python support
5252
~~~~~~~~~~~~~~
5353

5454
pandas will only drop support for specific Python versions (e.g. 3.6.x, 3.7.x) in

doc/source/development/roadmap.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ We'd like to fund improvements and maintenance of these tools to
152152

153153
.. _roadmap.evolution:
154154

155-
Roadmap Evolution
155+
Roadmap evolution
156156
-----------------
157157

158158
pandas continues to evolve. The direction is primarily determined by community

doc/source/reference/frame.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ Combining / joining / merging
251251
DataFrame.merge
252252
DataFrame.update
253253

254-
Time series-related
254+
Time Series-related
255255
~~~~~~~~~~~~~~~~~~~
256256
.. autosummary::
257257
:toctree: api/

doc/source/reference/indexing.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ DatetimeIndex
328328

329329
DatetimeIndex
330330

331-
Time/Date components
331+
Time/date components
332332
~~~~~~~~~~~~~~~~~~~~
333333
.. autosummary::
334334
:toctree: api/

doc/source/reference/series.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Binary operator functions
110110
Series.product
111111
Series.dot
112112

113-
Function application, groupby & window
113+
Function application, GroupBy & window
114114
--------------------------------------
115115
.. autosummary::
116116
:toctree: api/
@@ -249,7 +249,7 @@ Combining / joining / merging
249249
Series.replace
250250
Series.update
251251

252-
Time series-related
252+
Time Series-related
253253
-------------------
254254
.. autosummary::
255255
:toctree: api/

doc/source/whatsnew/v1.1.0.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,7 @@ Timedelta
310310
- Bug in constructing a :class:`Timedelta` with a high precision integer that would round the :class:`Timedelta` components (:issue:`31354`)
311311
- Bug in dividing ``np.nan`` or ``None`` by :class:`Timedelta`` incorrectly returning ``NaT`` (:issue:`31869`)
312312
- Timedeltas now understand ``µs`` as identifier for microsecond (:issue:`32899`)
313+
- :class:`Timedelta` string representation now includes nanoseconds, when nanoseconds are non-zero (:issue:`9309`)
313314

314315
Timezones
315316
^^^^^^^^^
@@ -423,7 +424,7 @@ Groupby/resample/rolling
423424
- Bug in :meth:`GroupBy.apply` raises ``ValueError`` when the ``by`` axis is not sorted and has duplicates and the applied ``func`` does not mutate passed in objects (:issue:`30667`)
424425
- Bug in :meth:`DataFrameGroupby.transform` produces incorrect result with transformation functions (:issue:`30918`)
425426
- Bug in :meth:`DataFrame.groupby` and :meth:`Series.groupby` produces inconsistent type when aggregating Boolean series (:issue:`32894`)
426-
427+
- Bug in :meth:`DataFrame.resample` where an ``AmbiguousTimeError`` would be raised when the resulting timezone aware :class:`DatetimeIndex` had a DST transition at midnight (:issue:`25758`)
427428

428429
Reshaping
429430
^^^^^^^^^

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,11 @@ cdef class _Timedelta(timedelta):
10721072
subs = (self._h or self._m or self._s or
10731073
self._ms or self._us or self._ns)
10741074

1075-
# by default not showing nano
10761075
if self._ms or self._us or self._ns:
10771076
seconds_fmt = "{seconds:02}.{milliseconds:03}{microseconds:03}"
1077+
if self._ns:
1078+
# GH#9309
1079+
seconds_fmt += "{nanoseconds:03}"
10781080
else:
10791081
seconds_fmt = "{seconds:02}"
10801082

pandas/core/generic.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8062,15 +8062,21 @@ def first(self: FrameOrSeries, offset) -> FrameOrSeries:
80628062

80638063
def last(self: FrameOrSeries, offset) -> FrameOrSeries:
80648064
"""
8065-
Method to subset final periods of time series data based on a date offset.
8065+
Select final periods of time series data based on a date offset.
8066+
8067+
When having a DataFrame with dates as index, this function can
8068+
select the last few rows based on a date offset.
80668069
80678070
Parameters
80688071
----------
80698072
offset : str, DateOffset, dateutil.relativedelta
8073+
The offset length of the data that will be selected. For instance,
8074+
'3D' will display all the rows having their index within the last 3 days.
80708075
80718076
Returns
80728077
-------
8073-
subset : same type as caller
8078+
Series or DataFrame
8079+
A subset of the caller.
80748080
80758081
Raises
80768082
------

0 commit comments

Comments
 (0)