Skip to content

Commit 15aa9d1

Browse files
committed
Merge remote-tracking branch 'upstream/master' into io_csv_docstring_fixed
* upstream/master: CI: Allow to compile docs with ipython 7.11 pandas-dev#22990 (pandas-dev#23655) DOC: Fix name of the See Also section titles in docstrings (pandas-dev#23653) DOC: clean-up recent doc errors/warnings (pandas-dev#23636)
2 parents bffda55 + 20bdb3e commit 15aa9d1

33 files changed

+181
-168
lines changed

ci/deps/travis-36-doc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ dependencies:
1111
- html5lib
1212
- hypothesis>=3.58.0
1313
- ipykernel
14-
- ipython==6.5.0
14+
- ipython
1515
- ipywidgets
1616
- lxml
1717
- matplotlib

doc/source/advanced.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -702,7 +702,7 @@ Index Types
702702

703703
We have discussed ``MultiIndex`` in the previous sections pretty extensively.
704704
Documentation about ``DatetimeIndex`` and ``PeriodIndex`` are shown :ref:`here <timeseries.overview>`,
705-
and documentation about ``TimedeltaIndex`` is found :ref:`here <timedeltas.timedeltaindex>`.
705+
and documentation about ``TimedeltaIndex`` is found :ref:`here <timedeltas.index>`.
706706

707707
In the following sub-sections we will highlight some other index types.
708708

doc/source/conf.py

+1
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@
388388
category=FutureWarning)
389389

390390

391+
ipython_warning_is_error = False
391392
ipython_exec_lines = [
392393
'import numpy as np',
393394
'import pandas as pd',

doc/source/ecosystem.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ which are utilized by Jupyter Notebook for displaying
140140
(Note: HTML tables may or may not be
141141
compatible with non-HTML Jupyter output formats.)
142142

143-
See :ref:`Options and Settings <options>` and :ref:`options.available <available>`
143+
See :ref:`Options and Settings <options>` and :ref:`options.available`
144144
for pandas ``display.`` settings.
145145

146146
`quantopian/qgrid <https://github.com/quantopian/qgrid>`__

doc/source/timeseries.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -2372,7 +2372,8 @@ can be controlled by the ``nonexistent`` argument. The following options are ava
23722372
* ``shift``: Shifts nonexistent times forward to the closest real time
23732373

23742374
.. ipython:: python
2375-
dti = date_range(start='2015-03-29 01:30:00', periods=3, freq='H')
2375+
2376+
dti = pd.date_range(start='2015-03-29 01:30:00', periods=3, freq='H')
23762377
# 2:30 is a nonexistent time
23772378
23782379
Localization of nonexistent times will raise an error by default.
@@ -2385,6 +2386,7 @@ Localization of nonexistent times will raise an error by default.
23852386
Transform nonexistent times to ``NaT`` or the closest real time forward in time.
23862387

23872388
.. ipython:: python
2389+
23882390
dti
23892391
dti.tz_localize('Europe/Warsaw', nonexistent='shift')
23902392
dti.tz_localize('Europe/Warsaw', nonexistent='NaT')

doc/source/whatsnew/v0.24.0.txt

+60-54
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ New features
1414
~~~~~~~~~~~~
1515
- :func:`merge` now directly allows merge between objects of type ``DataFrame`` and named ``Series``, without the need to convert the ``Series`` object into a ``DataFrame`` beforehand (:issue:`21220`)
1616
- ``ExcelWriter`` now accepts ``mode`` as a keyword argument, enabling append to existing workbooks when using the ``openpyxl`` engine (:issue:`3441`)
17-
- ``FrozenList`` has gained the ``.union()`` and ``.difference()`` methods. This functionality greatly simplifies groupby's that rely on explicitly excluding certain columns. See :ref:`Splitting an object into groups
18-
<groupby.split>` for more information (:issue:`15475`, :issue:`15506`)
17+
- ``FrozenList`` has gained the ``.union()`` and ``.difference()`` methods. This functionality greatly simplifies groupby's that rely on explicitly excluding certain columns. See :ref:`Splitting an object into groups <groupby.split>` for more information (:issue:`15475`, :issue:`15506`).
1918
- :func:`DataFrame.to_parquet` now accepts ``index`` as an argument, allowing
20-
the user to override the engine's default behavior to include or omit the
21-
dataframe's indexes from the resulting Parquet file. (:issue:`20768`)
19+
the user to override the engine's default behavior to include or omit the
20+
dataframe's indexes from the resulting Parquet file. (:issue:`20768`)
2221
- :meth:`DataFrame.corr` and :meth:`Series.corr` now accept a callable for generic calculation methods of correlation, e.g. histogram intersection (:issue:`22684`)
2322

2423

@@ -227,7 +226,7 @@ Other Enhancements
227226
- :class:`Series` and :class:`DataFrame` now support :class:`Iterable` in constructor (:issue:`2193`)
228227
- :class:`DatetimeIndex` gained :attr:`DatetimeIndex.timetz` attribute. Returns local time with timezone information. (:issue:`21358`)
229228
- :meth:`round`, :meth:`ceil`, and meth:`floor` for :class:`DatetimeIndex` and :class:`Timestamp` now support an ``ambiguous`` argument for handling datetimes that are rounded to ambiguous times (:issue:`18946`)
230-
- :meth:`round`, :meth:`ceil`, and meth:`floor` for :class:`DatetimeIndex` and :class:`Timestamp` now support a ``nonexistent`` argument for handling datetimes that are rounded to nonexistent times. See :ref:`timeseries.timezone_nonexsistent` (:issue:`22647`)
229+
- :meth:`round`, :meth:`ceil`, and meth:`floor` for :class:`DatetimeIndex` and :class:`Timestamp` now support a ``nonexistent`` argument for handling datetimes that are rounded to nonexistent times. See :ref:`timeseries.timezone_nonexistent` (:issue:`22647`)
231230
- :class:`Resampler` now is iterable like :class:`GroupBy` (:issue:`15314`).
232231
- :meth:`Series.resample` and :meth:`DataFrame.resample` have gained the :meth:`Resampler.quantile` (:issue:`15023`).
233232
- :meth:`pandas.core.dtypes.is_list_like` has gained a keyword ``allow_sets`` which is ``True`` by default; if ``False``,
@@ -237,7 +236,7 @@ Other Enhancements
237236
- Compatibility with Matplotlib 3.0 (:issue:`22790`).
238237
- Added :meth:`Interval.overlaps`, :meth:`IntervalArray.overlaps`, and :meth:`IntervalIndex.overlaps` for determining overlaps between interval-like objects (:issue:`21998`)
239238
- :func:`~DataFrame.to_parquet` now supports writing a ``DataFrame`` as a directory of parquet files partitioned by a subset of the columns when ``engine = 'pyarrow'`` (:issue:`23283`)
240-
- :meth:`Timestamp.tz_localize`, :meth:`DatetimeIndex.tz_localize`, and :meth:`Series.tz_localize` have gained the ``nonexistent`` argument for alternative handling of nonexistent times. See :ref:`timeseries.timezone_nonexsistent` (:issue:`8917`)
239+
- :meth:`Timestamp.tz_localize`, :meth:`DatetimeIndex.tz_localize`, and :meth:`Series.tz_localize` have gained the ``nonexistent`` argument for alternative handling of nonexistent times. See :ref:`timeseries.timezone_nonexistent` (:issue:`8917`)
241240
- :meth:`read_excel()` now accepts ``usecols`` as a list of column names or callable (:issue:`18273`)
242241

243242
.. _whatsnew_0240.api_breaking:
@@ -283,37 +282,37 @@ and replaced it with references to `pyarrow` (:issue:`21639` and :issue:`23053`)
283282
.. _whatsnew_0240.api_breaking.csv_line_terminator:
284283

285284
`os.linesep` is used for ``line_terminator`` of ``DataFrame.to_csv``
286-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
285+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
287286

288287
:func:`DataFrame.to_csv` now uses :func:`os.linesep` rather than ``'\n'``
289-
for the default line terminator (:issue:`20353`).
288+
for the default line terminator (:issue:`20353`).
290289
This change only affects when running on Windows, where ``'\r\n'`` was used for line terminator
291290
even when ``'\n'`` was passed in ``line_terminator``.
292291

293292
Previous Behavior on Windows:
294293

295294
.. code-block:: ipython
296295

297-
In [1]: data = pd.DataFrame({
298-
...: "string_with_lf": ["a\nbc"],
299-
...: "string_with_crlf": ["a\r\nbc"]
300-
...: })
296+
In [1]: data = pd.DataFrame({
297+
...: "string_with_lf": ["a\nbc"],
298+
...: "string_with_crlf": ["a\r\nbc"]
299+
...: })
301300

302-
In [2]: # When passing file PATH to to_csv, line_terminator does not work, and csv is saved with '\r\n'.
303-
...: # Also, this converts all '\n's in the data to '\r\n'.
304-
...: data.to_csv("test.csv", index=False, line_terminator='\n')
301+
In [2]: # When passing file PATH to to_csv, line_terminator does not work, and csv is saved with '\r\n'.
302+
...: # Also, this converts all '\n's in the data to '\r\n'.
303+
...: data.to_csv("test.csv", index=False, line_terminator='\n')
305304

306-
In [3]: with open("test.csv", mode='rb') as f:
307-
...: print(f.read())
308-
b'string_with_lf,string_with_crlf\r\n"a\r\nbc","a\r\r\nbc"\r\n'
305+
In [3]: with open("test.csv", mode='rb') as f:
306+
...: print(f.read())
307+
b'string_with_lf,string_with_crlf\r\n"a\r\nbc","a\r\r\nbc"\r\n'
309308

310-
In [4]: # When passing file OBJECT with newline option to to_csv, line_terminator works.
311-
...: with open("test2.csv", mode='w', newline='\n') as f:
312-
...: data.to_csv(f, index=False, line_terminator='\n')
309+
In [4]: # When passing file OBJECT with newline option to to_csv, line_terminator works.
310+
...: with open("test2.csv", mode='w', newline='\n') as f:
311+
...: data.to_csv(f, index=False, line_terminator='\n')
313312

314-
In [5]: with open("test2.csv", mode='rb') as f:
315-
...: print(f.read())
316-
b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n'
313+
In [5]: with open("test2.csv", mode='rb') as f:
314+
...: print(f.read())
315+
b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n'
317316

318317

319318
New Behavior on Windows:
@@ -322,54 +321,54 @@ New Behavior on Windows:
322321
- The value of ``line_terminator`` only affects the line terminator of CSV,
323322
so it does not change the value inside the data.
324323

325-
.. code-block:: ipython
324+
.. code-block:: ipython
326325

327-
In [1]: data = pd.DataFrame({
328-
...: "string_with_lf": ["a\nbc"],
329-
...: "string_with_crlf": ["a\r\nbc"]
330-
...: })
326+
In [1]: data = pd.DataFrame({
327+
...: "string_with_lf": ["a\nbc"],
328+
...: "string_with_crlf": ["a\r\nbc"]
329+
...: })
331330

332-
In [2]: data.to_csv("test.csv", index=False, line_terminator='\n')
331+
In [2]: data.to_csv("test.csv", index=False, line_terminator='\n')
333332

334-
In [3]: with open("test.csv", mode='rb') as f:
335-
...: print(f.read())
336-
b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n'
333+
In [3]: with open("test.csv", mode='rb') as f:
334+
...: print(f.read())
335+
b'string_with_lf,string_with_crlf\n"a\nbc","a\r\nbc"\n'
337336

338337

339338
- On Windows, the value of ``os.linesep`` is ``'\r\n'``,
340339
so if ``line_terminator`` is not set, ``'\r\n'`` is used for line terminator.
341340
- Again, it does not affect the value inside the data.
342341

343-
.. code-block:: ipython
342+
.. code-block:: ipython
344343

345-
In [1]: data = pd.DataFrame({
346-
...: "string_with_lf": ["a\nbc"],
347-
...: "string_with_crlf": ["a\r\nbc"]
348-
...: })
344+
In [1]: data = pd.DataFrame({
345+
...: "string_with_lf": ["a\nbc"],
346+
...: "string_with_crlf": ["a\r\nbc"]
347+
...: })
349348

350-
In [2]: data.to_csv("test.csv", index=False)
349+
In [2]: data.to_csv("test.csv", index=False)
351350

352-
In [3]: with open("test.csv", mode='rb') as f:
353-
...: print(f.read())
354-
b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n'
351+
In [3]: with open("test.csv", mode='rb') as f:
352+
...: print(f.read())
353+
b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n'
355354

356355

357356
- For files objects, specifying ``newline`` is not sufficient to set the line terminator.
358357
You must pass in the ``line_terminator`` explicitly, even in this case.
359358

360-
.. code-block:: ipython
359+
.. code-block:: ipython
361360

362-
In [1]: data = pd.DataFrame({
363-
...: "string_with_lf": ["a\nbc"],
364-
...: "string_with_crlf": ["a\r\nbc"]
365-
...: })
361+
In [1]: data = pd.DataFrame({
362+
...: "string_with_lf": ["a\nbc"],
363+
...: "string_with_crlf": ["a\r\nbc"]
364+
...: })
366365

367-
In [2]: with open("test2.csv", mode='w', newline='\n') as f:
368-
...: data.to_csv(f, index=False)
366+
In [2]: with open("test2.csv", mode='w', newline='\n') as f:
367+
...: data.to_csv(f, index=False)
369368

370-
In [3]: with open("test2.csv", mode='rb') as f:
371-
...: print(f.read())
372-
b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n'
369+
In [3]: with open("test2.csv", mode='rb') as f:
370+
...: print(f.read())
371+
b'string_with_lf,string_with_crlf\r\n"a\nbc","a\r\nbc"\r\n'
373372

374373
.. _whatsnew_0240.api_breaking.interval_values:
375374

@@ -777,17 +776,20 @@ Previous Behavior:
777776
df = pd.DataFrame(arr)
778777

779778
.. ipython:: python
779+
780780
# Comparison operations and arithmetic operations both broadcast.
781781
df == arr[[0], :]
782782
df + arr[[0], :]
783783

784784
.. ipython:: python
785+
785786
# Comparison operations and arithmetic operations both broadcast.
786787
df == (1, 2)
787788
df + (1, 2)
788789

789790
.. ipython:: python
790791
:okexcept:
792+
791793
# Comparison operations and arithmetic opeartions both raise ValueError.
792794
df == (1, 2, 3)
793795
df + (1, 2, 3)
@@ -797,8 +799,9 @@ Previous Behavior:
797799

798800
DataFrame Arithmetic Operations Broadcasting Changes
799801
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
802+
800803
:class:`DataFrame` arithmetic operations when operating with 2-dimensional
801-
``np.ndarray`` objects now broadcast in the same way as ``np.ndarray``s
804+
``np.ndarray`` objects now broadcast in the same way as ``np.ndarray``
802805
broadcast. (:issue:`23000`)
803806

804807
Previous Behavior:
@@ -817,11 +820,13 @@ Previous Behavior:
817820
*Current Behavior*:
818821

819822
.. ipython:: python
823+
820824
arr = np.arange(6).reshape(3, 2)
821825
df = pd.DataFrame(arr)
822826
df
823827

824828
.. ipython:: python
829+
825830
df + arr[[0], :] # 1 row, 2 columns
826831
df + arr[:, [1]] # 1 column, 3 rows
827832

@@ -888,7 +893,7 @@ Current Behavior:
888893
...
889894
OverflowError: Trying to coerce negative values to unsigned integers
890895

891-
.. _whatsnew_0240.api.crosstab_dtypes
896+
.. _whatsnew_0240.api.crosstab_dtypes:
892897

893898
Crosstab Preserves Dtypes
894899
^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -1008,6 +1013,7 @@ Current Behavior:
10081013

10091014
.. ipython:: python
10101015
:okwarning:
1016+
10111017
per = pd.Period('2016Q1')
10121018
per + 3
10131019

pandas/_libs/tslibs/period.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,7 @@ cdef class _Period(object):
17391739
-------
17401740
Timestamp
17411741
1742-
See also
1742+
See Also
17431743
--------
17441744
Period.end_time : Return the end Timestamp.
17451745
Period.dayofyear : Return the day of year.

pandas/_libs/tslibs/timedeltas.pyx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1111,14 +1111,14 @@ class Timedelta(_Timedelta):
11111111
Parameters
11121112
----------
11131113
value : Timedelta, timedelta, np.timedelta64, string, or integer
1114-
unit : string, {'Y', 'M', 'W', 'D', 'days', 'day',
1115-
'hours', hour', 'hr', 'h', 'm', 'minute', 'min', 'minutes',
1116-
'T', 'S', 'seconds', 'sec', 'second', 'ms',
1117-
'milliseconds', 'millisecond', 'milli', 'millis', 'L',
1118-
'us', 'microseconds', 'microsecond', 'micro', 'micros',
1119-
'U', 'ns', 'nanoseconds', 'nano', 'nanos', 'nanosecond'
1120-
'N'}, optional
1114+
unit : str, optional
11211115
Denote the unit of the input, if input is an integer. Default 'ns'.
1116+
Possible values:
1117+
{'Y', 'M', 'W', 'D', 'days', 'day', 'hours', hour', 'hr', 'h',
1118+
'm', 'minute', 'min', 'minutes', 'T', 'S', 'seconds', 'sec', 'second',
1119+
'ms', 'milliseconds', 'millisecond', 'milli', 'millis', 'L',
1120+
'us', 'microseconds', 'microsecond', 'micro', 'micros', 'U',
1121+
'ns', 'nanoseconds', 'nano', 'nanos', 'nanosecond', 'N'}
11221122
days, seconds, microseconds,
11231123
milliseconds, minutes, hours, weeks : numeric, optional
11241124
Values for construction in compat with datetime.timedelta.

pandas/core/accessor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def plot(self):
247247
>>> ds.geo.plot()
248248
# plots data on a map
249249
250-
See also
250+
See Also
251251
--------
252252
%(others)s
253253
"""

0 commit comments

Comments
 (0)