Skip to content

Commit c0c4338

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into typing-missing
2 parents 5036ee1 + 3556865 commit c0c4338

File tree

27 files changed

+514
-47
lines changed

27 files changed

+514
-47
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ on:
66
pull_request:
77
branches:
88
- master
9-
- 1.1.x
9+
- 1.2.x
1010

1111
env:
1212
ENV_FILE: environment.yml

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# Adapted from https://github.com/numba/numba/blob/master/azure-pipelines.yml
22
trigger:
33
- master
4-
- 1.1.x
4+
- 1.2.x
55

66
pr:
77
- master
8-
- 1.1.x
8+
- 1.2.x
99

1010
variables:
1111
PYTEST_WORKERS: auto

doc/source/user_guide/io.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3200,6 +3200,13 @@ pandas supports writing Excel files to buffer-like objects such as ``StringIO``
32003200
Excel writer engines
32013201
''''''''''''''''''''
32023202

3203+
.. deprecated:: 1.2.0
3204+
3205+
As the `xlwt <https://pypi.org/project/xlwt/>`__ package is no longer
3206+
maintained, the ``xlwt`` engine will be removed from a future version
3207+
of pandas. This is the only engine in pandas that supports writing to
3208+
``.xls`` files.
3209+
32033210
pandas chooses an Excel writer via two methods:
32043211

32053212
1. the ``engine`` keyword argument

doc/source/user_guide/options.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -432,6 +432,16 @@ display.html.use_mathjax True When True, Jupyter notebook
432432
dollar symbol.
433433
io.excel.xls.writer xlwt The default Excel writer engine for
434434
'xls' files.
435+
436+
.. deprecated:: 1.2.0
437+
438+
As `xlwt <https://pypi.org/project/xlwt/>`__
439+
package is no longer maintained, the ``xlwt``
440+
engine will be removed in a future version of
441+
pandas. Since this is the only engine in pandas
442+
that supports writing to ``.xls`` files,
443+
this option will also be removed.
444+
435445
io.excel.xlsm.writer openpyxl The default Excel writer engine for
436446
'xlsm' files. Available options:
437447
'openpyxl' (the default).

doc/source/whatsnew/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,14 @@ This is the list of changes to pandas between each release. For full details,
1010
see the `commit logs <https://github.com/pandas-dev/pandas/commits/>`_. For install and
1111
upgrade instructions, see :ref:`install`.
1212

13+
Version 1.3
14+
-----------
15+
16+
.. toctree::
17+
:maxdepth: 2
18+
19+
v1.3.0
20+
1321
Version 1.2
1422
-----------
1523

doc/source/whatsnew/v1.2.0.rst

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,27 @@ including other versions of pandas.
1010

1111
.. warning::
1212

13+
The packages `xlrd <https://xlrd.readthedocs.io/en/latest/>`_ for reading excel
14+
files and `xlwt <https://xlwt.readthedocs.io/en/latest/>`_ for
15+
writing excel files are no longer maintained. These are the only engines in pandas
16+
that support the xls format.
17+
1318
Previously, the default argument ``engine=None`` to ``pd.read_excel``
14-
would result in using the `xlrd <https://xlrd.readthedocs.io/en/latest/>`_ engine in
15-
many cases. The engine ``xlrd`` is no longer maintained, and is not supported with
16-
python >= 3.9. If `openpyxl <https://pypi.org/project/openpyxl/>`_ is installed,
17-
many of these cases will now default to using the ``openpyxl`` engine. See the
18-
:func:`read_excel` documentation for more details.
19+
would result in using the ``xlrd`` engine in many cases. If
20+
`openpyxl <https://openpyxl.readthedocs.io/en/stable/>`_ is installed,
21+
many of these cases will now default to using the ``openpyxl`` engine.
22+
See the :func:`read_excel` documentation for more details. Attempting to read
23+
``.xls`` files or specifying ``engine="xlrd"`` to ``pd.read_excel`` will not
24+
raise a warning. However users should be aware that ``xlrd`` is already
25+
broken with certain package configurations, for example with Python 3.9
26+
when `defusedxml <https://github.com/tiran/defusedxml/>`_ is installed, and
27+
is anticipated to be unusable in the future.
28+
29+
Attempting to use the the ``xlwt`` engine will raise a ``FutureWarning``
30+
unless the option :attr:`io.excel.xls.writer` is set to ``"xlwt"``.
31+
While this option is now deprecated and will also raise a ``FutureWarning``,
32+
it can be globally set and the warning suppressed. Users are recommended to
33+
write ``.xlsx`` files using the ``openpyxl`` engine instead.
1934

2035
.. ---------------------------------------------------------------------------
2136
@@ -260,6 +275,7 @@ Other enhancements
260275
- Added :meth:`~DataFrame.set_flags` for setting table-wide flags on a Series or DataFrame (:issue:`28394`)
261276
- :meth:`DataFrame.applymap` now supports ``na_action`` (:issue:`23803`)
262277
- :class:`Index` with object dtype supports division and multiplication (:issue:`34160`)
278+
- :meth:`io.sql.get_schema` now supports a ``schema`` keyword argument that will add a schema into the create table statement (:issue:`28486`)
263279
- :meth:`DataFrame.explode` and :meth:`Series.explode` now support exploding of sets (:issue:`35614`)
264280
- :meth:`DataFrame.hist` now supports time series (datetime) data (:issue:`32590`)
265281
- :meth:`.Styler.set_table_styles` now allows the direct styling of rows and columns and can be chained (:issue:`35607`)
@@ -479,7 +495,7 @@ Optional libraries below the lowest tested version may still work, but are not c
479495

480496
See :ref:`install.dependencies` and :ref:`install.optional_dependencies` for more.
481497

482-
.. _whatsnew_200.api.other:
498+
.. _whatsnew_120.api.other:
483499

484500
Other API changes
485501
^^^^^^^^^^^^^^^^^
@@ -850,4 +866,4 @@ Other
850866
Contributors
851867
~~~~~~~~~~~~
852868

853-
.. contributors:: v1.1.4..v1.2.0|HEAD
869+
.. contributors:: v1.1.5..v1.2.0|HEAD

doc/source/whatsnew/v1.3.0.rst

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
.. _whatsnew_130:
2+
3+
What's new in 1.3.0 (??)
4+
------------------------
5+
6+
These are the changes in pandas 1.3.0. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
13+
Enhancements
14+
~~~~~~~~~~~~
15+
16+
17+
.. _whatsnew_130.enhancements.other:
18+
19+
Other enhancements
20+
^^^^^^^^^^^^^^^^^^
21+
22+
-
23+
-
24+
25+
.. ---------------------------------------------------------------------------
26+
27+
.. _whatsnew_130.notable_bug_fixes:
28+
29+
Notable bug fixes
30+
~~~~~~~~~~~~~~~~~
31+
32+
These are bug fixes that might have notable behavior changes.
33+
34+
35+
36+
.. _whatsnew_130.api_breaking.deps:
37+
38+
Increased minimum versions for dependencies
39+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
40+
41+
42+
.. _whatsnew_130.api.other:
43+
44+
Other API changes
45+
^^^^^^^^^^^^^^^^^
46+
47+
-
48+
-
49+
50+
.. ---------------------------------------------------------------------------
51+
52+
.. _whatsnew_130.deprecations:
53+
54+
Deprecations
55+
~~~~~~~~~~~~
56+
57+
-
58+
-
59+
60+
.. ---------------------------------------------------------------------------
61+
62+
63+
.. _whatsnew_130.performance:
64+
65+
Performance improvements
66+
~~~~~~~~~~~~~~~~~~~~~~~~
67+
68+
-
69+
-
70+
71+
.. ---------------------------------------------------------------------------
72+
73+
.. _whatsnew_130.bug_fixes:
74+
75+
Bug fixes
76+
~~~~~~~~~
77+
78+
-
79+
-
80+
81+
Categorical
82+
^^^^^^^^^^^
83+
84+
-
85+
-
86+
87+
Datetimelike
88+
^^^^^^^^^^^^
89+
90+
-
91+
-
92+
93+
Timedelta
94+
^^^^^^^^^
95+
96+
-
97+
-
98+
99+
Timezones
100+
^^^^^^^^^
101+
102+
-
103+
-
104+
105+
Numeric
106+
^^^^^^^
107+
108+
-
109+
-
110+
111+
Conversion
112+
^^^^^^^^^^
113+
-
114+
-
115+
116+
Strings
117+
^^^^^^^
118+
119+
-
120+
-
121+
122+
Interval
123+
^^^^^^^^
124+
125+
-
126+
-
127+
128+
Indexing
129+
^^^^^^^^
130+
131+
-
132+
-
133+
134+
Missing
135+
^^^^^^^
136+
137+
-
138+
-
139+
140+
MultiIndex
141+
^^^^^^^^^^
142+
143+
-
144+
-
145+
146+
I/O
147+
^^^
148+
149+
-
150+
-
151+
152+
Period
153+
^^^^^^
154+
155+
-
156+
-
157+
158+
Plotting
159+
^^^^^^^^
160+
161+
-
162+
-
163+
164+
Groupby/resample/rolling
165+
^^^^^^^^^^^^^^^^^^^^^^^^
166+
167+
-
168+
-
169+
170+
Reshaping
171+
^^^^^^^^^
172+
173+
-
174+
-
175+
176+
Sparse
177+
^^^^^^
178+
179+
-
180+
-
181+
182+
ExtensionArray
183+
^^^^^^^^^^^^^^
184+
185+
-
186+
-
187+
188+
Other
189+
^^^^^
190+
191+
-
192+
-
193+
194+
.. ---------------------------------------------------------------------------
195+
196+
.. _whatsnew_130.contributors:
197+
198+
Contributors
199+
~~~~~~~~~~~~

pandas/core/algorithms.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ def isin(comps: AnyArrayLike, values: AnyArrayLike) -> np.ndarray:
440440
if not isinstance(
441441
values, (ABCIndexClass, ABCSeries, ABCExtensionArray, np.ndarray)
442442
):
443-
values = construct_1d_object_array_from_listlike(list(values))
444-
# TODO: could use ensure_arraylike here
443+
values = _ensure_arraylike(list(values))
445444
elif isinstance(values, ABCMultiIndex):
446445
# Avoid raising in extract_array
447446
values = np.array(values)

pandas/core/config_init.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,13 @@ def use_inf_as_na_cb(key):
581581
writer_engine_doc.format(ext="xls", others=", ".join(_xls_options)),
582582
validator=str,
583583
)
584+
cf.deprecate_option(
585+
"io.excel.xls.writer",
586+
msg="As the xlwt package is no longer maintained, the xlwt engine will be "
587+
"removed in a future version of pandas. This is the only engine in pandas that "
588+
"supports writing in the xls format. Install openpyxl and write to an "
589+
"xlsx file instead.",
590+
)
584591

585592
with cf.config_prefix("io.excel.xlsm"):
586593
cf.register_option(

pandas/core/dtypes/cast.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,6 @@ def maybe_downcast_numeric(result, dtype: DtypeObj, do_round: bool = False):
241241
# e.g. SparseDtype has no itemsize attr
242242
return result
243243

244-
if isinstance(result, list):
245-
# reached via groupby.agg._ohlc; really this should be handled earlier
246-
result = np.array(result)
247-
248244
def trans(x):
249245
if do_round:
250246
return x.round()
@@ -357,12 +353,18 @@ def maybe_cast_result_dtype(dtype: DtypeObj, how: str) -> DtypeObj:
357353
The desired dtype of the result.
358354
"""
359355
from pandas.core.arrays.boolean import BooleanDtype
360-
from pandas.core.arrays.integer import Int64Dtype
361-
362-
if how in ["add", "cumsum", "sum"] and (dtype == np.dtype(bool)):
363-
return np.dtype(np.int64)
364-
elif how in ["add", "cumsum", "sum"] and isinstance(dtype, BooleanDtype):
365-
return Int64Dtype()
356+
from pandas.core.arrays.floating import Float64Dtype
357+
from pandas.core.arrays.integer import Int64Dtype, _IntegerDtype
358+
359+
if how in ["add", "cumsum", "sum", "prod"]:
360+
if dtype == np.dtype(bool):
361+
return np.dtype(np.int64)
362+
elif isinstance(dtype, (BooleanDtype, _IntegerDtype)):
363+
return Int64Dtype()
364+
elif how in ["mean", "median", "var"] and isinstance(
365+
dtype, (BooleanDtype, _IntegerDtype)
366+
):
367+
return Float64Dtype()
366368
return dtype
367369

368370

0 commit comments

Comments
 (0)