Skip to content

Commit e2aa1e8

Browse files
committed
Merge branch 'master' into depr-ignore_only_none
2 parents 512c611 + 34b0bdc commit e2aa1e8

File tree

107 files changed

+1934
-1347
lines changed

Some content is hidden

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

107 files changed

+1934
-1347
lines changed

asv_bench/benchmarks/io/style.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,19 @@ def setup(self, cols, rows):
2020

2121
def time_apply_render(self, cols, rows):
2222
self._style_apply()
23-
self.st._render_html()
23+
self.st._render_html(True, True)
2424

2525
def peakmem_apply_render(self, cols, rows):
2626
self._style_apply()
27-
self.st._render_html()
27+
self.st._render_html(True, True)
2828

2929
def time_classes_render(self, cols, rows):
3030
self._style_classes()
31-
self.st._render_html()
31+
self.st._render_html(True, True)
3232

3333
def peakmem_classes_render(self, cols, rows):
3434
self._style_classes()
35-
self.st._render_html()
35+
self.st._render_html(True, True)
3636

3737
def time_format_render(self, cols, rows):
3838
self._style_format()

ci/deps/actions-37-minimum_versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
- bottleneck=1.2.1
1818
- jinja2=2.10
1919
- numba=0.46.0
20-
- numexpr=2.6.8
20+
- numexpr=2.7.0
2121
- numpy=1.17.3
2222
- openpyxl=3.0.0
2323
- pytables=3.5.1

doc/source/getting_started/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ Recommended dependencies
234234

235235
* `numexpr <https://github.com/pydata/numexpr>`__: for accelerating certain numerical operations.
236236
``numexpr`` uses multiple cores as well as smart chunking and caching to achieve large speedups.
237-
If installed, must be Version 2.6.8 or higher.
237+
If installed, must be Version 2.7.0 or higher.
238238

239239
* `bottleneck <https://github.com/pydata/bottleneck>`__: for accelerating certain types of ``nan``
240240
evaluations. ``bottleneck`` uses specialized cython routines to achieve large speedups. If installed,

doc/source/user_guide/options.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,11 @@ plotting.backend matplotlib Change the plotting backend
482482
like Bokeh, Altair, etc.
483483
plotting.matplotlib.register_converters True Register custom converters with
484484
matplotlib. Set to False to de-register.
485+
styler.sparse.index True "Sparsify" MultiIndex display for rows
486+
in Styler output (don't display repeated
487+
elements in outer levels within groups).
488+
styler.sparse.columns True "Sparsify" MultiIndex display for columns
489+
in Styler output.
485490
======================================= ============ ==================================
486491

487492

doc/source/whatsnew/v1.3.0.rst

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ precision, and perform HTML escaping (:issue:`40437` :issue:`40134`). There have
139139
properly format HTML and eliminate some inconsistencies (:issue:`39942` :issue:`40356` :issue:`39807` :issue:`39889` :issue:`39627`)
140140

141141
:class:`.Styler` has also been compatible with non-unique index or columns, at least for as many features as are fully compatible, others made only partially compatible (:issue:`41269`).
142+
One also has greater control of the display through separate sparsification of the index or columns, using the new 'styler' options context (:issue:`41142`).
142143

143144
Documentation has also seen major revisions in light of new features (:issue:`39720` :issue:`39317` :issue:`40493`)
144145

@@ -197,7 +198,7 @@ Other enhancements
197198
- Improved integer type mapping from pandas to SQLAlchemy when using :meth:`DataFrame.to_sql` (:issue:`35076`)
198199
- :func:`to_numeric` now supports downcasting of nullable ``ExtensionDtype`` objects (:issue:`33013`)
199200
- Add support for dict-like names in :class:`MultiIndex.set_names` and :class:`MultiIndex.rename` (:issue:`20421`)
200-
- :func:`pandas.read_excel` can now auto detect .xlsb files (:issue:`35416`)
201+
- :func:`pandas.read_excel` can now auto detect .xlsb files and older .xls files (:issue:`35416`, :issue:`41225`)
201202
- :class:`pandas.ExcelWriter` now accepts an ``if_sheet_exists`` parameter to control the behaviour of append mode when writing to existing sheets (:issue:`40230`)
202203
- :meth:`.Rolling.sum`, :meth:`.Expanding.sum`, :meth:`.Rolling.mean`, :meth:`.Expanding.mean`, :meth:`.ExponentialMovingWindow.mean`, :meth:`.Rolling.median`, :meth:`.Expanding.median`, :meth:`.Rolling.max`, :meth:`.Expanding.max`, :meth:`.Rolling.min`, and :meth:`.Expanding.min` now support ``Numba`` execution with the ``engine`` keyword (:issue:`38895`, :issue:`41267`)
203204
- :meth:`DataFrame.apply` can now accept NumPy unary operators as strings, e.g. ``df.apply("sqrt")``, which was already the case for :meth:`Series.apply` (:issue:`39116`)
@@ -228,7 +229,7 @@ Other enhancements
228229
- Constructing a :class:`DataFrame` or :class:`Series` with the ``data`` argument being a Python iterable that is *not* a NumPy ``ndarray`` consisting of NumPy scalars will now result in a dtype with a precision the maximum of the NumPy scalars; this was already the case when ``data`` is a NumPy ``ndarray`` (:issue:`40908`)
229230
- Add keyword ``sort`` to :func:`pivot_table` to allow non-sorting of the result (:issue:`39143`)
230231
- Add keyword ``dropna`` to :meth:`DataFrame.value_counts` to allow counting rows that include ``NA`` values (:issue:`41325`)
231-
-
232+
- :meth:`Series.replace` will now cast results to ``PeriodDtype`` where possible instead of ``object`` dtype (:issue:`41526`)
232233

233234
.. ---------------------------------------------------------------------------
234235
@@ -333,6 +334,31 @@ values as measured by ``np.allclose``. Now no such casting occurs.
333334
334335
df.groupby('key').agg(lambda x: x.sum())
335336
337+
``float`` result for :meth:`.GroupBy.mean`, :meth:`.GroupBy.median`, and :meth:`.GroupBy.var`
338+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
339+
340+
Previously, these methods could result in different dtypes depending on the input values.
341+
Now, these methods will always return a float dtype. (:issue:`41137`)
342+
343+
.. ipython:: python
344+
345+
df = pd.DataFrame({'a': [True], 'b': [1], 'c': [1.0]})
346+
347+
*pandas 1.2.x*
348+
349+
.. code-block:: ipython
350+
351+
In [5]: df.groupby(df.index).mean()
352+
Out[5]:
353+
a b c
354+
0 True 1 1.0
355+
356+
*pandas 1.3.0*
357+
358+
.. ipython:: python
359+
360+
df.groupby(df.index).mean()
361+
336362
Try operating inplace when setting values with ``loc`` and ``iloc``
337363
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
338364

@@ -547,7 +573,7 @@ If installed, we now require:
547573
+-----------------+-----------------+----------+---------+
548574
| bottleneck | 1.2.1 | | |
549575
+-----------------+-----------------+----------+---------+
550-
| numexpr | 2.6.8 | | |
576+
| numexpr | 2.7.0 | | X |
551577
+-----------------+-----------------+----------+---------+
552578
| pytest (dev) | 6.0 | | X |
553579
+-----------------+-----------------+----------+---------+
@@ -648,6 +674,9 @@ Deprecations
648674
- Deprecated setting :attr:`Categorical._codes`, create a new :class:`Categorical` with the desired codes instead (:issue:`40606`)
649675
- Deprecated behavior of :meth:`DatetimeIndex.union` with mixed timezones; in a future version both will be cast to UTC instead of object dtype (:issue:`39328`)
650676
- Deprecated using ``usecols`` with out of bounds indices for ``read_csv`` with ``engine="c"`` (:issue:`25623`)
677+
- Deprecated special treatment of lists with first element a Categorical in the :class:`DataFrame` constructor; pass as ``pd.DataFrame({col: categorical, ...})`` instead (:issue:`38845`)
678+
- Deprecated passing arguments as positional (except for ``"method"``) in :meth:`DataFrame.interpolate` and :meth:`Series.interpolate` (:issue:`41485`)
679+
- Deprecated passing arguments (apart from ``value``) as positional in :meth:`DataFrame.fillna` and :meth:`Series.fillna` (:issue:`41485`)
651680

652681
.. _whatsnew_130.deprecations.nuisance_columns:
653682

@@ -848,6 +877,7 @@ Missing
848877
- Bug in :func:`isna`, and :meth:`Series.isna`, :meth:`Index.isna`, :meth:`DataFrame.isna` (and the corresponding ``notna`` functions) not recognizing ``Decimal("NaN")`` objects (:issue:`39409`)
849878
- Bug in :meth:`DataFrame.fillna` not accepting dictionary for ``downcast`` keyword (:issue:`40809`)
850879
- Bug in :func:`isna` not returning a copy of the mask for nullable types, causing any subsequent mask modification to change the original array (:issue:`40935`)
880+
- Bug in :class:`DataFrame` construction with float data containing ``NaN`` and an integer ``dtype`` casting instead of retaining the ``NaN`` (:issue:`26919`)
851881

852882
MultiIndex
853883
^^^^^^^^^^
@@ -884,12 +914,15 @@ I/O
884914
- Bug in :func:`read_excel` dropping empty values from single-column spreadsheets (:issue:`39808`)
885915
- Bug in :func:`read_excel` loading trailing empty rows/columns for some filetypes (:issue:`41167`)
886916
- Bug in :func:`read_excel` raising ``AttributeError`` with ``MultiIndex`` header followed by two empty rows and no index, and bug affecting :func:`read_excel`, :func:`read_csv`, :func:`read_table`, :func:`read_fwf`, and :func:`read_clipboard` where one blank row after a ``MultiIndex`` header with no index would be dropped (:issue:`40442`)
887-
- Bug in :meth:`DataFrame.to_string` misplacing the truncation column when ``index=False`` (:issue:`40907`)
917+
- Bug in :meth:`DataFrame.to_string` misplacing the truncation column when ``index=False`` (:issue:`40904`)
918+
- Bug in :meth:`DataFrame.to_string` adding an extra dot and misaligning the truncation row when ``index=False`` (:issue:`40904`)
888919
- Bug in :func:`read_orc` always raising ``AttributeError`` (:issue:`40918`)
889920
- Bug in :func:`read_csv` and :func:`read_table` silently ignoring ``prefix`` if ``names`` and ``prefix`` are defined, now raising ``ValueError`` (:issue:`39123`)
890921
- Bug in :func:`read_csv` and :func:`read_excel` not respecting dtype for duplicated column name when ``mangle_dupe_cols`` is set to ``True`` (:issue:`35211`)
891922
- Bug in :func:`read_csv` and :func:`read_table` misinterpreting arguments when ``sys.setprofile`` had been previously called (:issue:`41069`)
892923
- Bug in the conversion from pyarrow to pandas (e.g. for reading Parquet) with nullable dtypes and a pyarrow array whose data buffer size is not a multiple of dtype size (:issue:`40896`)
924+
- Bug in :func:`read_excel` would raise an error when pandas could not determine the file type, even when user specified the ``engine`` argument (:issue:`41225`)
925+
-
893926

894927
Period
895928
^^^^^^
@@ -1013,6 +1046,7 @@ Other
10131046
- Bug in :meth:`DataFrame.equals`, :meth:`Series.equals`, :meth:`Index.equals` with object-dtype containing ``np.datetime64("NaT")`` or ``np.timedelta64("NaT")`` (:issue:`39650`)
10141047
- Bug in :func:`pandas.util.show_versions` where console JSON output was not proper JSON (:issue:`39701`)
10151048
- Bug in :meth:`DataFrame.convert_dtypes` incorrectly raised ValueError when called on an empty DataFrame (:issue:`40393`)
1049+
- Bug in :meth:`DataFrame.agg()` not sorting the aggregated axis in the order of the provided aggragation functions when one or more aggregation function fails to produce results (:issue:`33634`)
10161050
- Bug in :meth:`DataFrame.clip` not interpreting missing values as no threshold (:issue:`40420`)
10171051
- Bug in :class:`Series` backed by :class:`DatetimeArray` or :class:`TimedeltaArray` sometimes failing to set the array's ``freq`` to ``None`` (:issue:`41425`)
10181052

environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ dependencies:
8181
- ipython>=7.11.1
8282
- jinja2<3.0.0 # pandas.Styler
8383
- matplotlib>=2.2.2 # pandas.plotting, Series.plot, DataFrame.plot
84-
- numexpr>=2.6.8
84+
- numexpr>=2.7.0
8585
- scipy>=1.2
8686
- numba>=0.46.0
8787

pandas/_libs/lib.pyi

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ def is_integer(val: object) -> bool: ...
4040
def is_float(val: object) -> bool: ...
4141

4242
def is_interval_array(values: np.ndarray) -> bool: ...
43-
def is_period_array(values: np.ndarray) -> bool: ...
4443
def is_datetime64_array(values: np.ndarray) -> bool: ...
4544
def is_timedelta_or_timedelta64_array(values: np.ndarray) -> bool: ...
4645
def is_datetime_with_singletz_array(values: np.ndarray) -> bool: ...
@@ -67,50 +66,60 @@ def map_infer(
6766
@overload # both convert_datetime and convert_to_nullable_integer False -> np.ndarray
6867
def maybe_convert_objects(
6968
objects: np.ndarray, # np.ndarray[object]
69+
*,
7070
try_float: bool = ...,
7171
safe: bool = ...,
7272
convert_datetime: Literal[False] = ...,
7373
convert_timedelta: bool = ...,
74+
convert_period: Literal[False] = ...,
7475
convert_to_nullable_integer: Literal[False] = ...,
7576
) -> np.ndarray: ...
7677

7778
@overload
7879
def maybe_convert_objects(
7980
objects: np.ndarray, # np.ndarray[object]
81+
*,
8082
try_float: bool = ...,
8183
safe: bool = ...,
82-
convert_datetime: Literal[False] = False,
84+
convert_datetime: bool = ...,
8385
convert_timedelta: bool = ...,
86+
convert_period: bool = ...,
8487
convert_to_nullable_integer: Literal[True] = ...,
8588
) -> ArrayLike: ...
8689

8790
@overload
8891
def maybe_convert_objects(
8992
objects: np.ndarray, # np.ndarray[object]
93+
*,
9094
try_float: bool = ...,
9195
safe: bool = ...,
9296
convert_datetime: Literal[True] = ...,
9397
convert_timedelta: bool = ...,
94-
convert_to_nullable_integer: Literal[False] = ...,
98+
convert_period: bool = ...,
99+
convert_to_nullable_integer: bool = ...,
95100
) -> ArrayLike: ...
96101

97102
@overload
98103
def maybe_convert_objects(
99104
objects: np.ndarray, # np.ndarray[object]
105+
*,
100106
try_float: bool = ...,
101107
safe: bool = ...,
102-
convert_datetime: Literal[True] = ...,
108+
convert_datetime: bool = ...,
103109
convert_timedelta: bool = ...,
104-
convert_to_nullable_integer: Literal[True] = ...,
110+
convert_period: Literal[True] = ...,
111+
convert_to_nullable_integer: bool = ...,
105112
) -> ArrayLike: ...
106113

107114
@overload
108115
def maybe_convert_objects(
109116
objects: np.ndarray, # np.ndarray[object]
117+
*,
110118
try_float: bool = ...,
111119
safe: bool = ...,
112120
convert_datetime: bool = ...,
113121
convert_timedelta: bool = ...,
122+
convert_period: bool = ...,
114123
convert_to_nullable_integer: bool = ...,
115124
) -> ArrayLike: ...
116125

0 commit comments

Comments
 (0)