Skip to content

Commit 2ea1bd6

Browse files
committed
Merge remote-tracking branch 'upstream/master' into ci/locale_simplify
2 parents b4cefc6 + c2d0291 commit 2ea1bd6

File tree

10 files changed

+104
-48
lines changed

10 files changed

+104
-48
lines changed

ci/azure/posix.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@ jobs:
88
vmImage: ${{ parameters.vmImage }}
99
strategy:
1010
matrix:
11-
${{ if eq(parameters.name, 'macOS') }}:
12-
py38_macos_1:
13-
ENV_FILE: ci/deps/azure-macos-38.yaml
14-
CONDA_PY: "38"
15-
PATTERN: "not slow"
16-
PYTEST_TARGET: "pandas/tests/[a-h]*"
17-
py38_macos_2:
18-
ENV_FILE: ci/deps/azure-macos-38.yaml
19-
CONDA_PY: "38"
20-
PATTERN: "not slow"
21-
PYTEST_TARGET: "pandas/tests/[i-z]*"
11+
py38_macos_1:
12+
ENV_FILE: ci/deps/azure-macos-38.yaml
13+
CONDA_PY: "38"
14+
PATTERN: "not slow"
15+
PYTEST_TARGET: "pandas/tests/[a-h]*"
16+
py38_macos_2:
17+
ENV_FILE: ci/deps/azure-macos-38.yaml
18+
CONDA_PY: "38"
19+
PATTERN: "not slow"
20+
PYTEST_TARGET: "pandas/tests/[i-z]*"
2221

2322
steps:
2423
- script: echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'

ci/code_checks.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
7575
pandas/core \
7676
pandas/errors/ \
7777
pandas/io/ \
78+
pandas/plotting/ \
7879
pandas/tseries/ \
7980
pandas/util/ \
8081
pandas/_typing.py \

ci/setup_env.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ echo "w/o removing anything else"
7474
conda remove pandas -y --force || true
7575
pip uninstall -y pandas || true
7676

77-
echo
78-
echo "remove postgres if has been installed with conda"
79-
echo "we use the one from the CI"
80-
conda remove postgresql -y --force || true
81-
8277
echo
8378
echo "remove qt"
8479
echo "causes problems with the clipboard, we use xsel for that"
@@ -104,13 +99,4 @@ echo
10499
echo "conda list"
105100
conda list
106101

107-
# Install DB for Linux
108-
109-
if [[ -n ${SQL:0} ]]; then
110-
echo "installing dbs"
111-
mysql -e 'create database pandas_nosetest;'
112-
psql -c 'create database pandas_nosetest;' -U postgres
113-
else
114-
echo "not using dbs on non-linux Travis builds or Azure Pipelines"
115-
fi
116102
echo "done"

doc/source/whatsnew/v1.4.0.rst

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ Ignoring dtypes in concat with empty or all-NA columns
268268
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
269269

270270
When using :func:`concat` to concatenate two or more :class:`DataFrame` objects,
271-
if one of the DataFrames was empty or had all-NA values, its dtype was _sometimes_
272-
ignored when finding the concatenated dtype. These are now consistently _not_ ignored (:issue:`43507`).
271+
if one of the DataFrames was empty or had all-NA values, its dtype was *sometimes*
272+
ignored when finding the concatenated dtype. These are now consistently *not* ignored (:issue:`43507`).
273273

274274
.. ipython:: python
275275
@@ -297,7 +297,7 @@ Now the float-dtype is respected. Since the common dtype for these DataFrames is
297297
298298
res
299299
300-
.. _whatsnew_140.notable_bug_fixes.value_counts_and_mode_do_not_coerse_to_nan:
300+
.. _whatsnew_140.notable_bug_fixes.value_counts_and_mode_do_not_coerce_to_nan:
301301

302302
Null-values are no longer coerced to NaN-value in value_counts and mode
303303
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -535,7 +535,7 @@ Other Deprecations
535535
- Deprecated silent dropping of columns that raised a ``TypeError``, ``DataError``, and some cases of ``ValueError`` in :meth:`Series.aggregate`, :meth:`DataFrame.aggregate`, :meth:`Series.groupby.aggregate`, and :meth:`DataFrame.groupby.aggregate` when used with a list (:issue:`43740`)
536536
- Deprecated casting behavior when setting timezone-aware value(s) into a timezone-aware :class:`Series` or :class:`DataFrame` column when the timezones do not match. Previously this cast to object dtype. In a future version, the values being inserted will be converted to the series or column's existing timezone (:issue:`37605`)
537537
- Deprecated casting behavior when passing an item with mismatched-timezone to :meth:`DatetimeIndex.insert`, :meth:`DatetimeIndex.putmask`, :meth:`DatetimeIndex.where` :meth:`DatetimeIndex.fillna`, :meth:`Series.mask`, :meth:`Series.where`, :meth:`Series.fillna`, :meth:`Series.shift`, :meth:`Series.replace`, :meth:`Series.reindex` (and :class:`DataFrame` column analogues). In the past this has cast to object dtype. In a future version, these will cast the passed item to the index or series's timezone (:issue:`37605`,:issue:`44940`)
538-
- Deprecated the 'errors' keyword argument in :meth:`Series.where`, :meth:`DataFrame.where`, :meth:`Series.mask`, and meth:`DataFrame.mask`; in a future version the argument will be removed (:issue:`44294`)
538+
- Deprecated the 'errors' keyword argument in :meth:`Series.where`, :meth:`DataFrame.where`, :meth:`Series.mask`, and :meth:`DataFrame.mask`; in a future version the argument will be removed (:issue:`44294`)
539539
- Deprecated the ``prefix`` keyword argument in :func:`read_csv` and :func:`read_table`, in a future version the argument will be removed (:issue:`43396`)
540540
- Deprecated :meth:`PeriodIndex.astype` to ``datetime64[ns]`` or ``DatetimeTZDtype``, use ``obj.to_timestamp(how).tz_localize(dtype.tz)`` instead (:issue:`44398`)
541541
- Deprecated passing non boolean argument to sort in :func:`concat` (:issue:`41518`)
@@ -636,7 +636,7 @@ Datetimelike
636636
- Bug in adding a ``np.timedelta64`` object to a :class:`BusinessDay` or :class:`CustomBusinessDay` object incorrectly raising (:issue:`44532`)
637637
- Bug in :meth:`Index.insert` for inserting ``np.datetime64``, ``np.timedelta64`` or ``tuple`` into :class:`Index` with ``dtype='object'`` with negative loc adding ``None`` and replacing existing value (:issue:`44509`)
638638
- Bug in :meth:`Series.mode` with ``DatetimeTZDtype`` incorrectly returning timezone-naive and ``PeriodDtype`` incorrectly raising (:issue:`41927`)
639-
- Bug in :class:`DateOffset`` addition with :class:`Timestamp` where ``offset.nanoseconds`` would not be included in the result. (:issue:`43968`,:issue:`36589`)
639+
- Bug in :class:`DateOffset`` addition with :class:`Timestamp` where ``offset.nanoseconds`` would not be included in the result (:issue:`43968`, :issue:`36589`)
640640
-
641641

642642
Timedelta
@@ -715,19 +715,20 @@ Indexing
715715
- Bug in :meth:`DataFrame.loc.__setitem__` and :meth:`DataFrame.iloc.__setitem__` with mixed dtypes sometimes failing to operate in-place (:issue:`44345`)
716716
- Bug in :meth:`DataFrame.loc.__getitem__` incorrectly raising ``KeyError`` when selecting a single column with a boolean key (:issue:`44322`).
717717
- Bug in setting :meth:`DataFrame.iloc` with a single ``ExtensionDtype`` column and setting 2D values e.g. ``df.iloc[:] = df.values`` incorrectly raising (:issue:`44514`)
718+
- Bug in setting values with :meth:`DataFrame.iloc` with a single ``ExtensionDtype`` column and a tuple of arrays as the indexer (:issue:`44703`)
718719
- Bug in indexing on columns with ``loc`` or ``iloc`` using a slice with a negative step with ``ExtensionDtype`` columns incorrectly raising (:issue:`44551`)
719720
- Bug in :meth:`DataFrame.loc.__setitem__` changing dtype when indexer was completely ``False`` (:issue:`37550`)
720721
- Bug in :meth:`IntervalIndex.get_indexer_non_unique` returning boolean mask instead of array of integers for a non unique and non monotonic index (:issue:`44084`)
721722
- Bug in :meth:`IntervalIndex.get_indexer_non_unique` not handling targets of ``dtype`` 'object' with NaNs correctly (:issue:`44482`)
722723
- Fixed regression where a single column ``np.matrix`` was no longer coerced to a 1d ``np.ndarray`` when added to a :class:`DataFrame` (:issue:`42376`)
723-
- Bug in :meth:`Series.__getitem__` with a :class:`CategoricalIndex` of integers treating lists of integers as positional indexers, inconsistent with the behavior with a single scalar integer (:issue:`15470`,:issue:`14865`)
724+
- Bug in :meth:`Series.__getitem__` with a :class:`CategoricalIndex` of integers treating lists of integers as positional indexers, inconsistent with the behavior with a single scalar integer (:issue:`15470`, :issue:`14865`)
724725
-
725726

726727
Missing
727728
^^^^^^^
728729
- Bug in :meth:`DataFrame.fillna` with limit and no method ignores axis='columns' or ``axis = 1`` (:issue:`40989`)
729730
- Bug in :meth:`DataFrame.fillna` not replacing missing values when using a dict-like ``value`` and duplicate column names (:issue:`43476`)
730-
- Bug in constructing a :class:`DataFrame` with a dictionary ``np.datetime64`` as a value and ``dtype='timedelta64[ns]'``, or vice-versa, incorrectly casting instead of raising (:issue:`??`)
731+
- Bug in constructing a :class:`DataFrame` with a dictionary ``np.datetime64`` as a value and ``dtype='timedelta64[ns]'``, or vice-versa, incorrectly casting instead of raising (:issue:`44428`)
731732
- Bug in :meth:`Series.interpolate` and :meth:`DataFrame.interpolate` with ``inplace=True`` not writing to the underlying array(s) in-place (:issue:`44749`)
732733
- Bug in :meth:`Index.fillna` incorrectly returning an un-filled :class:`Index` when NA values are present and ``downcast`` argument is specified. This now raises ``NotImplementedError`` instead; do not pass ``downcast`` argument (:issue:`44873`)
733734
- Bug in :meth:`DataFrame.dropna` changing :class:`Index` even if no entries were dropped (:issue:`41965`)
@@ -751,7 +752,7 @@ I/O
751752
- Column headers are dropped when constructing a :class:`DataFrame` from a sqlalchemy's ``Row`` object (:issue:`40682`)
752753
- Bug in unpickling a :class:`Index` with object dtype incorrectly inferring numeric dtypes (:issue:`43188`)
753754
- Bug in :func:`read_csv` where reading multi-header input with unequal lengths incorrectly raising uncontrolled ``IndexError`` (:issue:`43102`)
754-
- Bug in :func:`read_csv` raising ``ParserError`` when reading file in chunks and aome chunk blocks have fewer columns than header for ``engine="c"`` (:issue:`21211`)
755+
- Bug in :func:`read_csv` raising ``ParserError`` when reading file in chunks and some chunk blocks have fewer columns than header for ``engine="c"`` (:issue:`21211`)
755756
- Bug in :func:`read_csv`, changed exception class when expecting a file path name or file-like object from ``OSError`` to ``TypeError`` (:issue:`43366`)
756757
- Bug in :func:`read_csv` and :func:`read_fwf` ignoring all ``skiprows`` except first when ``nrows`` is specified for ``engine='python'`` (:issue:`44021`, :issue:`10261`)
757758
- Bug in :func:`read_csv` keeping the original column in object format when ``keep_date_col=True`` is set (:issue:`13378`)
@@ -777,7 +778,7 @@ I/O
777778
- Bug in :func:`read_csv` where reading a mixed column of booleans and missing values to a float type results in the missing values becoming 1.0 rather than NaN (:issue:`42808`, :issue:`34120`)
778779
- Bug in :func:`read_csv` when passing simultaneously a parser in ``date_parser`` and ``parse_dates=False``, the parsing was still called (:issue:`44366`)
779780
- Bug in :func:`read_csv` not setting name of :class:`MultiIndex` columns correctly when ``index_col`` is not the first column (:issue:`38549`)
780-
- Bug in :func:`read_csv` silently ignoring errors when failling to create a memory-mapped file (:issue:`44766`)
781+
- Bug in :func:`read_csv` silently ignoring errors when failing to create a memory-mapped file (:issue:`44766`)
781782
- Bug in :func:`read_csv` when passing a ``tempfile.SpooledTemporaryFile`` opened in binary mode (:issue:`44748`)
782783
-
783784

@@ -791,7 +792,7 @@ Period
791792

792793
Plotting
793794
^^^^^^^^
794-
- When given non-numeric data, :meth:`DataFrame.boxplot` now raises a ``ValueError`` rather than a cryptic ``KeyError`` or ``ZeroDivsionError``, in line with other plotting functions like :meth:`DataFrame.hist`. (:issue:`43480`)
795+
- When given non-numeric data, :meth:`DataFrame.boxplot` now raises a ``ValueError`` rather than a cryptic ``KeyError`` or ``ZeroDivisionError``, in line with other plotting functions like :meth:`DataFrame.hist`. (:issue:`43480`)
795796
-
796797

797798
Groupby/resample/rolling
@@ -852,15 +853,15 @@ Sparse
852853
ExtensionArray
853854
^^^^^^^^^^^^^^
854855
- Bug in :func:`array` failing to preserve :class:`PandasArray` (:issue:`43887`)
855-
- NumPy ufuncs ``np.abs``, ``np.positive``, ``np.negative`` now correctly preserve dtype when called on ExtensionArrays that implement ``__abs__, __pos__, __neg__``, respectively. In particular this is fixed for :class:`TimedeltaArray` (:issue:`43899`,:issue:`23316`)
856+
- NumPy ufuncs ``np.abs``, ``np.positive``, ``np.negative`` now correctly preserve dtype when called on ExtensionArrays that implement ``__abs__, __pos__, __neg__``, respectively. In particular this is fixed for :class:`TimedeltaArray` (:issue:`43899`, :issue:`23316`)
856857
- NumPy ufuncs ``np.minimum.reduce`` and ``np.maximum.reduce`` now work correctly instead of raising ``NotImplementedError`` on :class:`Series` with ``IntegerDtype`` or ``FloatDtype`` (:issue:`43923`)
857858
- Avoid raising ``PerformanceWarning`` about fragmented DataFrame when using many columns with an extension dtype (:issue:`44098`)
858859
- Bug in :class:`IntegerArray` and :class:`FloatingArray` construction incorrectly coercing mismatched NA values (e.g. ``np.timedelta64("NaT")``) to numeric NA (:issue:`44514`)
859860
- Bug in :meth:`BooleanArray.__eq__` and :meth:`BooleanArray.__ne__` raising ``TypeError`` on comparison with an incompatible type (like a string). This caused :meth:`DataFrame.replace` to sometimes raise a ``TypeError`` if a nullable boolean column was included (:issue:`44499`)
860861
- Bug in :func:`array` incorrectly raising when passed a ``ndarray`` with ``float16`` dtype (:issue:`44715`)
861862
- Bug in calling ``np.sqrt`` on :class:`BooleanArray` returning a malformed :class:`FloatingArray` (:issue:`44715`)
862863
- Bug in :meth:`Series.where` with ``ExtensionDtype`` when ``other`` is a NA scalar incompatible with the series dtype (e.g. ``NaT`` with a numeric dtype) incorrectly casting to a compatible NA value (:issue:`44697`)
863-
- Fixed bug in :meth:`Series.replace` with ``FloatDtype``, ``string[python]``, or ``string[pyarrow]`` dtype not being preserved when possible (:issue:`33484`,:issue:`40732`,:issue:`31644`,:issue:`41215`,:issue:`25438`)
864+
- Fixed bug in :meth:`Series.replace` with ``FloatDtype``, ``string[python]``, or ``string[pyarrow]`` dtype not being preserved when possible (:issue:`33484`, :issue:`40732`, :issue:`31644`, :issue:`41215`, :issue:`25438`)
864865
-
865866

866867
Styler
@@ -882,7 +883,7 @@ Other
882883
- Bug in :meth:`RangeIndex.union` with another ``RangeIndex`` with matching (even) ``step`` and starts differing by strictly less than ``step / 2`` (:issue:`44019`)
883884
- Bug in :meth:`RangeIndex.difference` with ``sort=None`` and ``step<0`` failing to sort (:issue:`44085`)
884885
- Bug in :meth:`Series.to_frame` and :meth:`Index.to_frame` ignoring the ``name`` argument when ``name=None`` is explicitly passed (:issue:`44212`)
885-
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` with ``value=None`` and ExtensionDtypes (:issue:`44270`,:issue:`37899`)
886+
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` with ``value=None`` and ExtensionDtypes (:issue:`44270`, :issue:`37899`)
886887
- Bug in :meth:`FloatingArray.equals` failing to consider two arrays equal if they contain ``np.nan`` values (:issue:`44382`)
887888
- Bug in :meth:`DataFrame.shift` with ``axis=1`` and ``ExtensionDtype`` columns incorrectly raising when an incompatible ``fill_value`` is passed (:issue:`44564`)
888889
- Bug in :meth:`DataFrame.shift` with ``axis=1`` and ``periods`` larger than ``len(frame.columns)`` producing an invalid :class:`DataFrame` (:issue:`44978`)

pandas/core/internals/blocks.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,14 @@ def setitem(self, indexer, value):
15121512
# TODO(EA2D): not needed with 2D EAs
15131513
# we are always 1-D
15141514
indexer = indexer[0]
1515+
if isinstance(indexer, np.ndarray) and indexer.ndim == 2:
1516+
# GH#44703
1517+
if indexer.shape[1] != 1:
1518+
raise NotImplementedError(
1519+
"This should not be reached. Please report a bug at "
1520+
"github.com/pandas-dev/pandas/"
1521+
)
1522+
indexer = indexer[:, 0]
15151523

15161524
# TODO(EA2D): not needed with 2D EAS
15171525
if isinstance(value, (np.ndarray, ExtensionArray)) and value.ndim == 2:

pandas/plotting/_core.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ def hist_frame(
338338
>>> np.random.seed(1234)
339339
>>> df = pd.DataFrame(np.random.randn(10, 4),
340340
... columns=['Col1', 'Col2', 'Col3', 'Col4'])
341-
>>> boxplot = df.boxplot(column=['Col1', 'Col2', 'Col3'])
341+
>>> boxplot = df.boxplot(column=['Col1', 'Col2', 'Col3']) # doctest: +SKIP
342342
343343
Boxplots of variables distributions grouped by the values of a third
344344
variable can be created using the option ``by``. For instance:
@@ -381,7 +381,7 @@ def hist_frame(
381381
.. plot::
382382
:context: close-figs
383383
384-
>>> boxplot = df.boxplot(grid=False, rot=45, fontsize=15)
384+
>>> boxplot = df.boxplot(grid=False, rot=45, fontsize=15) # doctest: +SKIP
385385
386386
The parameter ``return_type`` can be used to select the type of element
387387
returned by `boxplot`. When ``return_type='axes'`` is selected,
@@ -591,14 +591,14 @@ def boxplot_frame_groupby(
591591
>>> data = np.random.randn(len(index),4)
592592
>>> df = pd.DataFrame(data, columns=list('ABCD'), index=index)
593593
>>> grouped = df.groupby(level='lvl1')
594-
>>> grouped.boxplot(rot=45, fontsize=12, figsize=(8,10))
594+
>>> grouped.boxplot(rot=45, fontsize=12, figsize=(8,10)) # doctest: +SKIP
595595
596596
The ``subplots=False`` option shows the boxplots in a single figure.
597597
598598
.. plot::
599599
:context: close-figs
600600
601-
>>> grouped.boxplot(subplots=False, rot=45, fontsize=12)
601+
>>> grouped.boxplot(subplots=False, rot=45, fontsize=12) # doctest: +SKIP
602602
"""
603603
plot_backend = _get_plot_backend(backend)
604604
return plot_backend.boxplot_frame_groupby(
@@ -987,6 +987,7 @@ def __call__(self, *args, **kwargs):
987987
988988
>>> s = pd.Series([1, 3, 2])
989989
>>> s.plot.line()
990+
<AxesSubplot:ylabel='Density'>
990991
991992
.. plot::
992993
:context: close-figs

pandas/plotting/_matplotlib/groupby.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,15 @@ def create_iter_data_given_by(
4949
... [3, 4, np.nan, np.nan], [np.nan, np.nan, 5, 6]]
5050
>>> data = DataFrame(value, columns=mi)
5151
>>> create_iter_data_given_by(data)
52-
{'h1': DataFrame({'a': [1, 3, np.nan], 'b': [3, 4, np.nan]}),
53-
'h2': DataFrame({'a': [np.nan, np.nan, 5], 'b': [np.nan, np.nan, 6]})}
52+
{'h1': h1
53+
a b
54+
0 1.0 3.0
55+
1 3.0 4.0
56+
2 NaN NaN, 'h2': h2
57+
a b
58+
0 NaN NaN
59+
1 NaN NaN
60+
2 5.0 6.0}
5461
"""
5562

5663
# For `hist` plot, before transformation, the values in level 0 are values
@@ -96,10 +103,10 @@ def reconstruct_data_with_by(
96103
>>> df = DataFrame(d)
97104
>>> reconstruct_data_with_by(df, by='h', cols=['a', 'b'])
98105
h1 h2
99-
a b a b
100-
0 1 3 NaN NaN
101-
1 3 4 NaN NaN
102-
2 NaN NaN 5 6
106+
a b a b
107+
0 1.0 3.0 NaN NaN
108+
1 3.0 4.0 NaN NaN
109+
2 NaN NaN 5.0 6.0
103110
"""
104111
grouped = data.groupby(by)
105112

0 commit comments

Comments
 (0)