Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pandas for openSUSE:Factory checked in at 2021-03-12 13:30:55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pandas (Old) and /work/SRC/openSUSE:Factory/.python-pandas.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pandas" Fri Mar 12 13:30:55 2021 rev:33 rq:877583 version:1.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pandas/python-pandas.changes 2021-02-16 22:34:22.793488076 +0100 +++ /work/SRC/openSUSE:Factory/.python-pandas.new.2401/python-pandas.changes 2021-03-12 13:31:12.914148730 +0100 @@ -1,0 +2,25 @@ +Wed Mar 3 19:10:52 UTC 2021 - Arun Persaud <a...@gmx.de> + +- update to version 1.2.3: + * Fixed regressions + + Fixed regression in to_excel() raising KeyError when giving + duplicate columns with columns attribute (GH39695) + + Fixed regression in nullable integer unary ops propagating mask + on assignment (GH39943) + + Fixed regression in DataFrame.__setitem__() not aligning + DataFrame on right-hand side for boolean indexer (GH39931) + + Fixed regression in to_json() failing to use compression with + URL-like paths that are internally opened in binary mode or with + user-provided file objects that are opened in binary mode + (GH39985) + + Fixed regression in Series.sort_index() and + DataFrame.sort_index(), which exited with an ungraceful error + when having kwarg ascending=None passed. Passing ascending=None + is still considered invalid, and the improved error message + suggests a proper usage (ascending must be a boolean or a + list-like of boolean) (GH39434) + + Fixed regression in DataFrame.transform() and Series.transform() + giving incorrect column labels when passed a dictionary with a + mix of list and non-list values (GH40018) + +------------------------------------------------------------------- Old: ---- pandas-1.2.2.tar.gz New: ---- pandas-1.2.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pandas.spec ++++++ --- /var/tmp/diff_new_pack.AcWSsw/_old 2021-03-12 13:31:13.494149543 +0100 +++ /var/tmp/diff_new_pack.AcWSsw/_new 2021-03-12 13:31:13.498149549 +0100 @@ -28,7 +28,7 @@ %bcond_with test %endif Name: python-pandas%{psuffix} -Version: 1.2.2 +Version: 1.2.3 Release: 0 Summary: Python data structures for data analysis, time series, and statistics License: BSD-3-Clause @@ -49,15 +49,19 @@ Requires: python-numpy >= 1.16.5 Requires: python-python-dateutil >= 2.7.3 Requires: python-pytz >= 2017.3 -Recommends: python-numexpr >= 2.6.8 Recommends: python-Bottleneck >= 1.2.1 +Recommends: python-numexpr >= 2.6.8 +Suggests: python-Jinja2 >= 2.10 +Suggests: python-PyMySQL >= 0.8.1 +Suggests: python-QtPy +Suggests: python-SQLAlchemy >= 1.3.0 +Suggests: python-XlsxWriter >= 1.0.2 Suggests: python-beautifulsoup4 >= 4.6.0 Suggests: python-blosc >= 1.17.0 Suggests: python-fastparquet >= 0.4.0 Suggests: python-fsspec >= 0.7.4 Suggests: python-gcsfs >= 0.6.0 Suggests: python-html5lib >= 1.0.1 -Suggests: python-Jinja2 >= 2.10 Suggests: python-lxml >= 4.3.0 Suggests: python-matplotlib >= 2.2.3 Suggests: python-numba >= 0.46.0 @@ -65,19 +69,15 @@ Suggests: python-pandas-gbq >= 0.12.0 Suggests: python-psycopg2 >= 2.7 Suggests: python-pyarrow >= 0.15.0 -Suggests: python-PyMySQL >= 0.8.1 Suggests: python-pyreadstat Suggests: python-qt5 -Suggests: python-QtPy Suggests: python-s3fs >= 0.4.0 Suggests: python-scipy >= 1.12.0 -Suggests: python-SQLAlchemy >= 1.3.0 Suggests: python-tables >= 3.5.1 Suggests: python-tabulate >= 0.8.3 Suggests: python-xarray >= 0.8.2 Suggests: python-xlrd >= 1.2.0 Suggests: python-xlsb >= 1.0.6 -Suggests: python-XlsxWriter >= 1.0.2 Suggests: python-zlib Suggests: xclip Suggests: xsel ++++++ pandas-1.2.2.tar.gz -> pandas-1.2.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/PKG-INFO new/pandas-1.2.3/PKG-INFO --- old/pandas-1.2.2/PKG-INFO 2021-02-09 11:59:57.670000000 +0100 +++ new/pandas-1.2.3/PKG-INFO 2021-03-02 10:48:07.583455300 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pandas -Version: 1.2.2 +Version: 1.2.3 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Maintainer: The PyData Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/doc/source/conf.py new/pandas-1.2.3/doc/source/conf.py --- old/pandas-1.2.2/doc/source/conf.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/doc/source/conf.py 2021-03-02 10:43:35.000000000 +0100 @@ -409,7 +409,7 @@ if pattern is None: intersphinx_mapping = { "dateutil": ("https://dateutil.readthedocs.io/en/latest/", None), - "matplotlib": ("https://matplotlib.org/", None), + "matplotlib": ("https://matplotlib.org/stable/", None), "numpy": ("https://numpy.org/doc/stable/", None), "pandas-gbq": ("https://pandas-gbq.readthedocs.io/en/latest/", None), "py": ("https://pylib.readthedocs.io/en/latest/", None), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/doc/source/user_guide/cookbook.rst new/pandas-1.2.3/doc/source/user_guide/cookbook.rst --- old/pandas-1.2.2/doc/source/user_guide/cookbook.rst 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/doc/source/user_guide/cookbook.rst 2021-03-02 10:43:35.000000000 +0100 @@ -1410,7 +1410,7 @@ corr_mat.where(mask) -The ``method`` argument within ``DataFrame.corr`` can accept a callable in addition to the named correlation types. Here we compute the ``distance correlation <https://en.wikipedia.org/wiki/Distance_correlation>``__ matrix for a ``DataFrame`` object. +The ``method`` argument within ``DataFrame.corr`` can accept a callable in addition to the named correlation types. Here we compute the `distance correlation <https://en.wikipedia.org/wiki/Distance_correlation>`__ matrix for a ``DataFrame`` object. .. ipython:: python diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/doc/source/whatsnew/index.rst new/pandas-1.2.3/doc/source/whatsnew/index.rst --- old/pandas-1.2.2/doc/source/whatsnew/index.rst 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/doc/source/whatsnew/index.rst 2021-03-02 10:43:35.000000000 +0100 @@ -16,6 +16,7 @@ .. toctree:: :maxdepth: 2 + v1.2.3 v1.2.2 v1.2.1 v1.2.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/doc/source/whatsnew/v1.2.2.rst new/pandas-1.2.3/doc/source/whatsnew/v1.2.2.rst --- old/pandas-1.2.2/doc/source/whatsnew/v1.2.2.rst 2021-02-09 11:38:51.000000000 +0100 +++ new/pandas-1.2.3/doc/source/whatsnew/v1.2.2.rst 2021-03-02 10:42:13.000000000 +0100 @@ -46,4 +46,4 @@ Contributors ~~~~~~~~~~~~ -.. contributors:: v1.2.1..v1.2.2|HEAD +.. contributors:: v1.2.1..v1.2.2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/doc/source/whatsnew/v1.2.3.rst new/pandas-1.2.3/doc/source/whatsnew/v1.2.3.rst --- old/pandas-1.2.2/doc/source/whatsnew/v1.2.3.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/pandas-1.2.3/doc/source/whatsnew/v1.2.3.rst 2021-03-02 10:42:13.000000000 +0100 @@ -0,0 +1,32 @@ +.. _whatsnew_123: + +What's new in 1.2.3 (March 02, 2021) +------------------------------------ + +These are the changes in pandas 1.2.3. See :ref:`release` for a full changelog +including other versions of pandas. + +{{ header }} + +.. --------------------------------------------------------------------------- + +.. _whatsnew_123.regressions: + +Fixed regressions +~~~~~~~~~~~~~~~~~ + +- Fixed regression in :meth:`~DataFrame.to_excel` raising ``KeyError`` when giving duplicate columns with ``columns`` attribute (:issue:`39695`) +- Fixed regression in nullable integer unary ops propagating mask on assignment (:issue:`39943`) +- Fixed regression in :meth:`DataFrame.__setitem__` not aligning :class:`DataFrame` on right-hand side for boolean indexer (:issue:`39931`) +- Fixed regression in :meth:`~DataFrame.to_json` failing to use ``compression`` with URL-like paths that are internally opened in binary mode or with user-provided file objects that are opened in binary mode (:issue:`39985`) +- Fixed regression in :meth:`Series.sort_index` and :meth:`DataFrame.sort_index`, which exited with an ungraceful error when having kwarg ``ascending=None`` passed. Passing ``ascending=None`` is still considered invalid, and the improved error message suggests a proper usage (``ascending`` must be a boolean or a list-like of boolean) (:issue:`39434`) +- Fixed regression in :meth:`DataFrame.transform` and :meth:`Series.transform` giving incorrect column labels when passed a dictionary with a mix of list and non-list values (:issue:`40018`) + +.. --------------------------------------------------------------------------- + +.. _whatsnew_123.contributors: + +Contributors +~~~~~~~~~~~~ + +.. contributors:: v1.2.2..v1.2.3|HEAD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/_version.py new/pandas-1.2.3/pandas/_version.py --- old/pandas-1.2.2/pandas/_version.py 2021-02-09 11:59:57.670000000 +0100 +++ new/pandas-1.2.3/pandas/_version.py 2021-03-02 10:48:07.583455300 +0100 @@ -8,11 +8,11 @@ version_json = ''' { - "date": "2021-02-09T10:55:19+0000", + "date": "2021-03-02T09:43:36+0000", "dirty": false, "error": null, - "full-revisionid": "7d32926db8f7541c356066dcadabf854487738de", - "version": "1.2.2" + "full-revisionid": "f2c8480af2f25efdbd803218b9d87980f416563e", + "version": "1.2.3" } ''' # END VERSION_JSON diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/aggregation.py new/pandas-1.2.3/pandas/core/aggregation.py --- old/pandas-1.2.2/pandas/core/aggregation.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/aggregation.py 2021-03-02 10:43:35.000000000 +0100 @@ -491,6 +491,22 @@ # GH 15931 - deprecation of renaming keys raise SpecificationError("nested renamer is not supported") + is_aggregator = lambda x: isinstance(x, (list, tuple, dict)) + + # if we have a dict of any non-scalars + # eg. {'A' : ['mean']}, normalize all to + # be list-likes + # Cannot use func.values() because arg may be a Series + if any(is_aggregator(x) for _, x in func.items()): + new_func: AggFuncTypeDict = {} + for k, v in func.items(): + if not is_aggregator(v): + # mypy can't realize v is not a list here + new_func[k] = [v] # type:ignore[list-item] + else: + new_func[k] = v + func = new_func + results: Dict[Label, FrameOrSeriesUnion] = {} for name, how in func.items(): colg = obj._gotitem(name, ndim=1) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/arrays/integer.py new/pandas-1.2.3/pandas/core/arrays/integer.py --- old/pandas-1.2.2/pandas/core/arrays/integer.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/arrays/integer.py 2021-03-02 10:43:35.000000000 +0100 @@ -348,13 +348,13 @@ super().__init__(values, mask, copy=copy) def __neg__(self): - return type(self)(-self._data, self._mask) + return type(self)(-self._data, self._mask.copy()) def __pos__(self): return self def __abs__(self): - return type(self)(np.abs(self._data), self._mask) + return type(self)(np.abs(self._data), self._mask.copy()) @classmethod def _from_sequence( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/arrays/masked.py new/pandas-1.2.3/pandas/core/arrays/masked.py --- old/pandas-1.2.2/pandas/core/arrays/masked.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/arrays/masked.py 2021-03-02 10:43:35.000000000 +0100 @@ -142,7 +142,7 @@ return len(self._data) def __invert__(self: BaseMaskedArrayT) -> BaseMaskedArrayT: - return type(self)(~self._data, self._mask) + return type(self)(~self._data, self._mask.copy()) def to_numpy( self, dtype=None, copy: bool = False, na_value: Scalar = lib.no_default diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/frame.py new/pandas-1.2.3/pandas/core/frame.py --- old/pandas-1.2.2/pandas/core/frame.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/frame.py 2021-03-02 10:43:35.000000000 +0100 @@ -3179,6 +3179,9 @@ key = check_bool_indexer(self.index, key) indexer = key.nonzero()[0] self._check_setitem_copy() + if isinstance(value, DataFrame): + # GH#39931 reindex since iloc does not align + value = value.reindex(self.index.take(indexer)) self.iloc[indexer] = value else: if isinstance(value, DataFrame): @@ -3951,8 +3954,8 @@ .. deprecated:: 1.2.0 DataFrame.lookup is deprecated, use DataFrame.melt and DataFrame.loc instead. - For an example see :meth:`~pandas.DataFrame.lookup` - in the user guide. + For further details see + :ref:`Looking up values by index/column labels <indexing.lookup>`. Parameters ---------- @@ -5479,7 +5482,7 @@ self, axis=0, level=None, - ascending: bool = True, + ascending: Union[Union[bool, int], Sequence[Union[bool, int]]] = True, inplace: bool = False, kind: str = "quicksort", na_position: str = "last", @@ -5500,7 +5503,7 @@ and 1 identifies the columns. level : int or level name or list of ints or list of level names If not None, sort on values in specified index level(s). - ascending : bool or list of bools, default True + ascending : bool or list-like of bools, default True Sort ascending vs. descending. When the index is a MultiIndex the sort direction can be controlled for each level individually. inplace : bool, default False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/generic.py new/pandas-1.2.3/pandas/core/generic.py --- old/pandas-1.2.2/pandas/core/generic.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/generic.py 2021-03-02 10:43:35.000000000 +0100 @@ -56,6 +56,7 @@ from pandas.errors import AbstractMethodError, InvalidIndexError from pandas.util._decorators import doc, rewrite_axis_style_signature from pandas.util._validators import ( + validate_ascending, validate_bool_kwarg, validate_fillna_kwargs, validate_percentile, @@ -4518,7 +4519,7 @@ self, axis=0, level=None, - ascending: bool_t = True, + ascending: Union[Union[bool_t, int], Sequence[Union[bool_t, int]]] = True, inplace: bool_t = False, kind: str = "quicksort", na_position: str = "last", @@ -4529,6 +4530,8 @@ inplace = validate_bool_kwarg(inplace, "inplace") axis = self._get_axis_number(axis) + ascending = validate_ascending(ascending) + target = self._get_axis(axis) indexer = get_indexer_indexer( @@ -6438,6 +6441,7 @@ return result.__finalize__(self, method="fillna") @final + @doc(klass=_shared_doc_kwargs["klass"]) def ffill( self: FrameOrSeries, axis=None, @@ -6460,6 +6464,7 @@ pad = ffill @final + @doc(klass=_shared_doc_kwargs["klass"]) def bfill( self: FrameOrSeries, axis=None, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/series.py new/pandas-1.2.3/pandas/core/series.py --- old/pandas-1.2.2/pandas/core/series.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/series.py 2021-03-02 10:43:35.000000000 +0100 @@ -12,9 +12,11 @@ Iterable, List, Optional, + Sequence, Tuple, Type, Union, + cast, ) import warnings @@ -3065,7 +3067,7 @@ def sort_values( self, axis=0, - ascending=True, + ascending: Union[Union[bool, int], Sequence[Union[bool, int]]] = True, inplace: bool = False, kind: str = "quicksort", na_position: str = "last", @@ -3083,7 +3085,7 @@ axis : {0 or 'index'}, default 0 Axis to direct sorting. The value 'index' is accepted for compatibility with DataFrame.sort_values. - ascending : bool, default True + ascending : bool or list of bools, default True If True, sort values in ascending order, otherwise descending. inplace : bool, default False If True, perform operation in-place. @@ -3243,6 +3245,7 @@ ) if is_list_like(ascending): + ascending = cast(Sequence[Union[bool, int]], ascending) if len(ascending) != 1: raise ValueError( f"Length of ascending ({len(ascending)}) must be 1 for Series" @@ -3257,7 +3260,7 @@ # GH 35922. Make sorting stable by leveraging nargsort values_to_sort = ensure_key_mapped(self, key)._values if key else self._values - sorted_index = nargsort(values_to_sort, kind, ascending, na_position) + sorted_index = nargsort(values_to_sort, kind, bool(ascending), na_position) result = self._constructor( self._values[sorted_index], index=self.index[sorted_index] @@ -3275,7 +3278,7 @@ self, axis=0, level=None, - ascending: bool = True, + ascending: Union[Union[bool, int], Sequence[Union[bool, int]]] = True, inplace: bool = False, kind: str = "quicksort", na_position: str = "last", @@ -3295,7 +3298,7 @@ Axis to direct sorting. This can only be 0 for Series. level : int, optional If not None, sort on values in specified index level(s). - ascending : bool or list of bools, default True + ascending : bool or list-like of bools, default True Sort ascending vs. descending. When the index is a MultiIndex the sort direction can be controlled for each level individually. inplace : bool, default False diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/core/sorting.py new/pandas-1.2.3/pandas/core/sorting.py --- old/pandas-1.2.2/pandas/core/sorting.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/core/sorting.py 2021-03-02 10:43:35.000000000 +0100 @@ -8,6 +8,7 @@ Iterable, List, Optional, + Sequence, Tuple, Union, ) @@ -39,7 +40,7 @@ def get_indexer_indexer( target: "Index", level: Union[str, int, List[str], List[int]], - ascending: bool, + ascending: Union[Sequence[Union[bool, int]], Union[bool, int]], kind: str, na_position: str, sort_remaining: bool, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/io/clipboard/__init__.py new/pandas-1.2.3/pandas/io/clipboard/__init__.py --- old/pandas-1.2.2/pandas/io/clipboard/__init__.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/io/clipboard/__init__.py 2021-03-02 10:43:35.000000000 +0100 @@ -59,7 +59,7 @@ EXCEPT_MSG = """ Pyperclip could not find a copy/paste mechanism for your system. For more information, please visit - https://pyperclip.readthedocs.io/en/latest/introduction.html#not-implemented-error + https://pyperclip.readthedocs.io/en/latest/#not-implemented-error """ ENCODING = "utf-8" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/io/formats/excel.py new/pandas-1.2.3/pandas/io/formats/excel.py --- old/pandas-1.2.2/pandas/io/formats/excel.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/io/formats/excel.py 2021-03-02 10:43:35.000000000 +0100 @@ -465,7 +465,7 @@ if not len(Index(cols).intersection(df.columns)): raise KeyError("passes columns are not ALL present dataframe") - if len(Index(cols).intersection(df.columns)) != len(cols): + if len(Index(cols).intersection(df.columns)) != len(set(cols)): # Deprecated in GH#17295, enforced in 1.0.0 raise KeyError("Not all names specified in 'columns' are found") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/io/json/_json.py new/pandas-1.2.3/pandas/io/json/_json.py --- old/pandas-1.2.2/pandas/io/json/_json.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/io/json/_json.py 2021-03-02 10:43:35.000000000 +0100 @@ -100,7 +100,7 @@ if path_or_buf is not None: # apply compression and byte/text conversion with get_handle( - path_or_buf, "wt", compression=compression, storage_options=storage_options + path_or_buf, "w", compression=compression, storage_options=storage_options ) as handles: handles.handle.write(s) else: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/arrays/masked/test_arithmetic.py new/pandas-1.2.3/pandas/tests/arrays/masked/test_arithmetic.py --- old/pandas-1.2.2/pandas/tests/arrays/masked/test_arithmetic.py 2021-02-09 11:38:51.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/arrays/masked/test_arithmetic.py 2021-03-02 10:43:35.000000000 +0100 @@ -159,3 +159,16 @@ s = pd.Series(data) with pytest.raises(ValueError, match="Lengths must match"): op(s, other) + + +@pytest.mark.parametrize("op", ["__neg__", "__abs__", "__invert__"]) +@pytest.mark.parametrize( + "values, dtype", [([1, 2, 3], "Int64"), ([True, False, True], "boolean")] +) +def test_unary_op_does_not_propagate_mask(op, values, dtype): + # https://github.com/pandas-dev/pandas/issues/39943 + s = pd.Series(values, dtype=dtype) + result = getattr(s, op)() + expected = result.copy(deep=True) + s[0] = None + tm.assert_series_equal(result, expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/arrays/sparse/test_array.py new/pandas-1.2.3/pandas/tests/arrays/sparse/test_array.py --- old/pandas-1.2.2/pandas/tests/arrays/sparse/test_array.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/arrays/sparse/test_array.py 2021-03-02 10:43:35.000000000 +0100 @@ -1174,7 +1174,9 @@ row = [0, 3, 1, 0] col = [0, 3, 1, 2] data = [4, 5, 7, 9] - sp_array = scipy.sparse.coo_matrix((data, (row, col))) + # TODO: Remove dtype when scipy is fixed + # https://github.com/scipy/scipy/issues/13585 + sp_array = scipy.sparse.coo_matrix((data, (row, col)), dtype="int") result = pd.Series.sparse.from_coo(sp_array) index = pd.MultiIndex.from_arrays([[0, 0, 1, 3], [0, 2, 1, 3]]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/arrays/string_/test_string.py new/pandas-1.2.3/pandas/tests/arrays/string_/test_string.py --- old/pandas-1.2.2/pandas/tests/arrays/string_/test_string.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/arrays/string_/test_string.py 2021-03-02 10:43:35.000000000 +0100 @@ -14,13 +14,8 @@ @pytest.fixture( params=[ - # pandas\tests\arrays\string_\test_string.py:16: error: List item 1 has - # incompatible type "ParameterSet"; expected - # "Sequence[Collection[object]]" [list-item] "string", - pytest.param( - "arrow_string", marks=skip_if_no_pyarrow - ), # type:ignore[list-item] + pytest.param("arrow_string", marks=skip_if_no_pyarrow), ] ) def dtype(request): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/frame/apply/test_frame_transform.py new/pandas-1.2.3/pandas/tests/frame/apply/test_frame_transform.py --- old/pandas-1.2.2/pandas/tests/frame/apply/test_frame_transform.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/frame/apply/test_frame_transform.py 2021-03-02 10:43:35.000000000 +0100 @@ -99,6 +99,17 @@ tm.assert_frame_equal(result, expected) +def test_transform_dictlike_mixed(): + # GH 40018 - mix of lists and non-lists in values of a dictionary + df = DataFrame({"a": [1, 2], "b": [1, 4], "c": [1, 4]}) + result = df.transform({"b": ["sqrt", "abs"], "c": "sqrt"}) + expected = DataFrame( + [[1.0, 1, 1.0], [2.0, 4, 2.0]], + columns=MultiIndex([("b", "c"), ("sqrt", "abs")], [(0, 0, 1), (0, 1, 0)]), + ) + tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize( "ops", [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/frame/indexing/test_setitem.py new/pandas-1.2.3/pandas/tests/frame/indexing/test_setitem.py --- old/pandas-1.2.2/pandas/tests/frame/indexing/test_setitem.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/frame/indexing/test_setitem.py 2021-03-02 10:43:35.000000000 +0100 @@ -404,3 +404,12 @@ expected = df.copy() expected.values[np.array(mask)] = np.nan tm.assert_frame_equal(result, expected) + + @pytest.mark.parametrize("indexer", [lambda x: x, lambda x: x.loc]) + def test_setitem_boolean_mask_aligning(self, indexer): + # GH#39931 + df = DataFrame({"a": [1, 4, 2, 3], "b": [5, 6, 7, 8]}) + expected = df.copy() + mask = df["a"] >= 3 + indexer(df)[mask] = indexer(df)[mask].sort_values("a") + tm.assert_frame_equal(df, expected) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/frame/methods/test_sort_index.py new/pandas-1.2.3/pandas/tests/frame/methods/test_sort_index.py --- old/pandas-1.2.2/pandas/tests/frame/methods/test_sort_index.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/frame/methods/test_sort_index.py 2021-03-02 10:43:35.000000000 +0100 @@ -765,6 +765,23 @@ ) tm.assert_frame_equal(result, expected) + @pytest.mark.parametrize( + "ascending", + [ + None, + [True, None], + [False, "True"], + ], + ) + def test_sort_index_ascending_bad_value_raises(self, ascending): + # GH 39434 + df = DataFrame(np.arange(64)) + length = len(df.index) + df.index = [(i - length / 2) % length for i in range(length)] + match = 'For argument "ascending" expected type bool' + with pytest.raises(ValueError, match=match): + df.sort_index(axis=0, ascending=ascending, na_position="first") + class TestDataFrameSortIndexKey: def test_sort_multi_index_key(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/io/excel/test_writers.py new/pandas-1.2.3/pandas/tests/io/excel/test_writers.py --- old/pandas-1.2.2/pandas/tests/io/excel/test_writers.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/io/excel/test_writers.py 2021-03-02 10:43:35.000000000 +0100 @@ -1295,6 +1295,15 @@ with pytest.raises(ValueError, match="Excel does not support"): df.to_excel(path) + def test_excel_duplicate_columns_with_names(self, path): + # GH#39695 + df = DataFrame({"A": [0, 1], "B": [10, 11]}) + df.to_excel(path, columns=["A", "B", "A"], index=False) + + result = pd.read_excel(path) + expected = DataFrame([[0, 10, 0], [1, 11, 1]], columns=["A", "B", "A.1"]) + tm.assert_frame_equal(result, expected) + class TestExcelWriterEngineTests: @pytest.mark.parametrize( diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/io/json/test_compression.py new/pandas-1.2.3/pandas/tests/io/json/test_compression.py --- old/pandas-1.2.2/pandas/tests/io/json/test_compression.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/io/json/test_compression.py 2021-03-02 10:43:35.000000000 +0100 @@ -1,3 +1,5 @@ +from io import BytesIO + import pytest import pandas.util._test_decorators as td @@ -115,3 +117,13 @@ df.to_json(path, compression=to_compression) result = pd.read_json(path, compression=read_compression) tm.assert_frame_equal(result, df) + + +def test_to_json_compression_mode(compression): + # GH 39985 (read_json does not support user-provided binary files) + expected = pd.DataFrame({"A": [1]}) + + with BytesIO() as buffer: + expected.to_json(buffer, compression=compression) + # df = pd.read_json(buffer, compression=compression) + # tm.assert_frame_equal(expected, df) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/io/json/test_json_table_schema.py new/pandas-1.2.3/pandas/tests/io/json/test_json_table_schema.py --- old/pandas-1.2.2/pandas/tests/io/json/test_json_table_schema.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/io/json/test_json_table_schema.py 2021-03-02 10:43:35.000000000 +0100 @@ -745,6 +745,9 @@ result = pd.read_json(out, orient="table") tm.assert_frame_equal(df, result) + @pytest.mark.filterwarnings( + "ignore:an integer is required (got type float)*:DeprecationWarning" + ) def test_comprehensive(self): df = DataFrame( { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/io/test_fsspec.py new/pandas-1.2.3/pandas/tests/io/test_fsspec.py --- old/pandas-1.2.2/pandas/tests/io/test_fsspec.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/io/test_fsspec.py 2021-03-02 10:43:35.000000000 +0100 @@ -249,11 +249,19 @@ tm.assert_frame_equal(df, out) -def test_json_options(fsspectest): +def test_json_options(fsspectest, compression): df = DataFrame({"a": [0]}) - df.to_json("testmem://afile", storage_options={"test": "json_write"}) + df.to_json( + "testmem://afile", + compression=compression, + storage_options={"test": "json_write"}, + ) assert fsspectest.test[0] == "json_write" - out = read_json("testmem://afile", storage_options={"test": "json_read"}) + out = read_json( + "testmem://afile", + compression=compression, + storage_options={"test": "json_read"}, + ) assert fsspectest.test[0] == "json_read" tm.assert_frame_equal(df, out) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/series/apply/test_series_transform.py new/pandas-1.2.3/pandas/tests/series/apply/test_series_transform.py --- old/pandas-1.2.2/pandas/tests/series/apply/test_series_transform.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/series/apply/test_series_transform.py 2021-03-02 10:43:35.000000000 +0100 @@ -1,7 +1,7 @@ import numpy as np import pytest -from pandas import DataFrame, Series, concat +from pandas import DataFrame, MultiIndex, Series, concat import pandas._testing as tm from pandas.core.base import SpecificationError from pandas.core.groupby.base import transformation_kernels @@ -52,6 +52,17 @@ tm.assert_frame_equal(result, expected) +def test_transform_dictlike_mixed(): + # GH 40018 - mix of lists and non-lists in values of a dictionary + df = Series([1, 4]) + result = df.transform({"b": ["sqrt", "abs"], "c": "sqrt"}) + expected = DataFrame( + [[1.0, 1, 1.0], [2.0, 4, 2.0]], + columns=MultiIndex([("b", "c"), ("sqrt", "abs")], [(0, 0, 1), (0, 1, 0)]), + ) + tm.assert_frame_equal(result, expected) + + def test_transform_wont_agg(string_series): # GH 35964 # we are trying to transform with an aggregator diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/series/methods/test_sort_index.py new/pandas-1.2.3/pandas/tests/series/methods/test_sort_index.py --- old/pandas-1.2.2/pandas/tests/series/methods/test_sort_index.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/series/methods/test_sort_index.py 2021-03-02 10:43:35.000000000 +0100 @@ -199,6 +199,20 @@ expected = ser.iloc[[0, 4, 1, 5, 2, 6, 3, 7]] tm.assert_series_equal(result, expected) + @pytest.mark.parametrize( + "ascending", + [ + None, + (True, None), + (False, "True"), + ], + ) + def test_sort_index_ascending_bad_value_raises(self, ascending): + ser = Series(range(10), index=[0, 3, 2, 1, 4, 5, 7, 6, 8, 9]) + match = 'For argument "ascending" expected type bool' + with pytest.raises(ValueError, match=match): + ser.sort_index(ascending=ascending) + class TestSeriesSortIndexKey: def test_sort_index_multiindex_key(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/tests/window/conftest.py new/pandas-1.2.3/pandas/tests/window/conftest.py --- old/pandas-1.2.2/pandas/tests/window/conftest.py 2021-02-09 11:55:18.000000000 +0100 +++ new/pandas-1.2.3/pandas/tests/window/conftest.py 2021-03-02 10:43:35.000000000 +0100 @@ -100,9 +100,7 @@ @pytest.fixture( params=[ - pytest.param( - "numba", marks=td.skip_if_no("numba", "0.46.0") - ), # type: ignore[list-item] + pytest.param("numba", marks=td.skip_if_no("numba", "0.46.0")), "cython", ] ) @@ -318,7 +316,7 @@ "float64", "m8[ns]", "M8[ns]", - pytest.param( # type: ignore[list-item] + pytest.param( "datetime64[ns, UTC]", marks=pytest.mark.skip( "direct creation of extension dtype datetime64[ns, UTC] " diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas/util/_validators.py new/pandas-1.2.3/pandas/util/_validators.py --- old/pandas-1.2.2/pandas/util/_validators.py 2021-02-09 11:38:51.000000000 +0100 +++ new/pandas-1.2.3/pandas/util/_validators.py 2021-03-02 10:43:35.000000000 +0100 @@ -2,7 +2,7 @@ Module that contains many useful utilities for validating data or function arguments """ -from typing import Iterable, Union +from typing import Iterable, Sequence, Union import warnings import numpy as np @@ -205,9 +205,39 @@ validate_kwargs(fname, kwargs, compat_args) -def validate_bool_kwarg(value, arg_name): - """ Ensures that argument passed in arg_name is of type bool. """ - if not (is_bool(value) or value is None): +def validate_bool_kwarg(value, arg_name, none_allowed=True, int_allowed=False): + """ + Ensure that argument passed in arg_name can be interpreted as boolean. + + Parameters + ---------- + value : bool + Value to be validated. + arg_name : str + Name of the argument. To be reflected in the error message. + none_allowed : bool, default True + Whether to consider None to be a valid boolean. + int_allowed : bool, default False + Whether to consider integer value to be a valid boolean. + + Returns + ------- + value + The same value as input. + + Raises + ------ + ValueError + If the value is not a valid boolean. + """ + good_value = is_bool(value) + if none_allowed: + good_value = good_value or value is None + + if int_allowed: + good_value = good_value or isinstance(value, int) + + if not good_value: raise ValueError( f'For argument "{arg_name}" expected type bool, received ' f"type {type(value).__name__}." @@ -381,3 +411,14 @@ if not all(0 <= qs <= 1 for qs in q_arr): raise ValueError(msg.format(q_arr / 100.0)) return q_arr + + +def validate_ascending( + ascending: Union[Union[bool, int], Sequence[Union[bool, int]]] = True, +): + """Validate ``ascending`` kwargs for ``sort_index`` method.""" + kwargs = {"none_allowed": False, "int_allowed": True} + if not isinstance(ascending, (list, tuple)): + return validate_bool_kwarg(ascending, "ascending", **kwargs) + + return [validate_bool_kwarg(item, "ascending", **kwargs) for item in ascending] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas.egg-info/PKG-INFO new/pandas-1.2.3/pandas.egg-info/PKG-INFO --- old/pandas-1.2.2/pandas.egg-info/PKG-INFO 2021-02-09 11:59:57.000000000 +0100 +++ new/pandas-1.2.3/pandas.egg-info/PKG-INFO 2021-03-02 10:48:07.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: pandas -Version: 1.2.2 +Version: 1.2.3 Summary: Powerful data structures for data analysis, time series, and statistics Home-page: https://pandas.pydata.org Maintainer: The PyData Development Team diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/pandas.egg-info/SOURCES.txt new/pandas-1.2.3/pandas.egg-info/SOURCES.txt --- old/pandas-1.2.2/pandas.egg-info/SOURCES.txt 2021-02-09 11:59:57.000000000 +0100 +++ new/pandas-1.2.3/pandas.egg-info/SOURCES.txt 2021-03-02 10:48:07.000000000 +0100 @@ -213,6 +213,7 @@ doc/source/whatsnew/v1.2.0.rst doc/source/whatsnew/v1.2.1.rst doc/source/whatsnew/v1.2.2.rst +doc/source/whatsnew/v1.2.3.rst doc/sphinxext/README.rst doc/sphinxext/announce.py doc/sphinxext/contributors.py diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pandas-1.2.2/setup.cfg new/pandas-1.2.3/setup.cfg --- old/pandas-1.2.2/setup.cfg 2021-02-09 11:59:57.670000000 +0100 +++ new/pandas-1.2.3/setup.cfg 2021-03-02 10:48:07.583455300 +0100 @@ -107,6 +107,7 @@ warn_redundant_casts = True warn_unused_ignores = True show_error_codes = True +no_site_packages = True [mypy-pandas.tests.*] check_untyped_defs = False