Skip to content

Commit 2e17322

Browse files
committed
Merge remote-tracking branch 'upstream/master' into allow-special-characters-query
2 parents 291cd40 + f437a04 commit 2e17322

File tree

103 files changed

+682
-536
lines changed

Some content is hidden

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

103 files changed

+682
-536
lines changed

asv_bench/benchmarks/index_object.py

+13
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
Float64Index,
88
Index,
99
IntervalIndex,
10+
MultiIndex,
1011
RangeIndex,
1112
Series,
1213
date_range,
@@ -111,6 +112,18 @@ def time_get_loc_dec(self):
111112
self.idx_dec.get_loc(100000)
112113

113114

115+
class IndexEquals:
116+
def setup(self):
117+
idx_large_fast = RangeIndex(100000)
118+
idx_small_slow = date_range(start="1/1/2012", periods=1)
119+
self.mi_large_slow = MultiIndex.from_product([idx_large_fast, idx_small_slow])
120+
121+
self.idx_non_object = RangeIndex(1)
122+
123+
def time_non_object_equals_multiindex(self):
124+
self.idx_non_object.equals(self.mi_large_slow)
125+
126+
114127
class IndexAppend:
115128
def setup(self):
116129

asv_bench/benchmarks/multiindex_object.py

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import numpy as np
44

5-
from pandas import DataFrame, MultiIndex, date_range
5+
from pandas import DataFrame, MultiIndex, RangeIndex, date_range
66
import pandas.util.testing as tm
77

88

@@ -147,4 +147,16 @@ def time_categorical_level(self):
147147
self.df.set_index(["a", "b"])
148148

149149

150+
class Equals:
151+
def setup(self):
152+
idx_large_fast = RangeIndex(100000)
153+
idx_small_slow = date_range(start="1/1/2012", periods=1)
154+
self.mi_large_slow = MultiIndex.from_product([idx_large_fast, idx_small_slow])
155+
156+
self.idx_non_object = RangeIndex(1)
157+
158+
def time_equals_non_object_index(self):
159+
self.mi_large_slow.equals(self.idx_non_object)
160+
161+
150162
from .pandas_vb_common import setup # noqa: F401 isort:skip

ci/azure/posix.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ jobs:
2020
CONDA_PY: "36"
2121
PATTERN: "not slow and not network"
2222
py36_locale_slow_old_np:
23-
ENV_FILE: ci/deps/azure-36-locale.yaml
23+
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
2424
CONDA_PY: "36"
2525
PATTERN: "slow"
2626
LOCALE_OVERRIDE: "zh_CN.UTF-8"
2727
EXTRA_APT: "language-pack-zh-hans"
2828

29-
py36_locale_slow:
30-
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
29+
py36_locale:
30+
ENV_FILE: ci/deps/azure-36-locale.yaml
3131
CONDA_PY: "36"
3232
PATTERN: "not slow and not network"
3333
LOCALE_OVERRIDE: "it_IT.UTF-8"

ci/code_checks.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,12 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
105105

106106
# Imports - Check formatting using isort see setup.cfg for settings
107107
MSG='Check import format using isort ' ; echo $MSG
108-
isort --recursive --check-only pandas asv_bench
108+
ISORT_CMD="isort --recursive --check-only pandas asv_bench"
109+
if [[ "$GITHUB_ACTIONS" == "true" ]]; then
110+
eval $ISORT_CMD | awk '{print "##[error]" $0}'; RET=$(($RET + ${PIPESTATUS[0]}))
111+
else
112+
eval $ISORT_CMD
113+
fi
109114
RET=$(($RET + $?)) ; echo $MSG "DONE"
110115

111116
fi

ci/deps/azure-36-locale.yaml

+20-16
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,27 @@ dependencies:
1313
- pytest-azurepipelines
1414

1515
# pandas dependencies
16-
- beautifulsoup4==4.6.0
17-
- bottleneck=1.2.*
16+
- beautifulsoup4
17+
- gcsfs
18+
- html5lib
19+
- ipython
20+
- jinja2
1821
- lxml
19-
- matplotlib=2.2.2
20-
- numpy=1.14.*
21-
- openpyxl=2.4.8
22-
- python-dateutil
23-
- python-blosc
24-
- pytz=2017.2
25-
- scipy
26-
- sqlalchemy=1.1.4
27-
- xlrd=1.1.0
28-
- xlsxwriter=0.9.8
29-
- xlwt=1.2.0
22+
- matplotlib=3.0.*
23+
- nomkl
24+
- numexpr
25+
- numpy=1.15.*
26+
- openpyxl
3027
# lowest supported version of pyarrow (putting it here instead of in
3128
# azure-36-minimum_versions because it needs numpy >= 1.14)
3229
- pyarrow=0.12
33-
- pip
34-
- pip:
35-
- html5lib==1.0b2
30+
- pytables
31+
- python-dateutil
32+
- pytz
33+
- s3fs
34+
- scipy
35+
- xarray
36+
- xlrd
37+
- xlsxwriter
38+
- xlwt
39+
- moto

ci/deps/azure-36-locale_slow.yaml

+14-18
Original file line numberDiff line numberDiff line change
@@ -13,24 +13,20 @@ dependencies:
1313
- pytest-azurepipelines
1414

1515
# pandas dependencies
16-
- beautifulsoup4
17-
- gcsfs
18-
- html5lib
19-
- ipython
20-
- jinja2
16+
- beautifulsoup4==4.6.0
17+
- bottleneck=1.2.*
2118
- lxml
22-
- matplotlib=3.0.*
23-
- nomkl
24-
- numexpr
25-
- numpy=1.15.*
26-
- openpyxl
27-
- pytables
19+
- matplotlib=2.2.2
20+
- numpy=1.14.*
21+
- openpyxl=2.4.8
2822
- python-dateutil
29-
- pytz
30-
- s3fs
23+
- python-blosc
24+
- pytz=2017.2
3125
- scipy
32-
- xarray
33-
- xlrd
34-
- xlsxwriter
35-
- xlwt
36-
- moto
26+
- sqlalchemy=1.1.4
27+
- xlrd=1.1.0
28+
- xlsxwriter=0.9.8
29+
- xlwt=1.2.0
30+
- pip
31+
- pip:
32+
- html5lib==1.0b2

doc/redirects.csv

-2
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,6 @@ generated/pandas.DataFrame.clip_upper,../reference/api/pandas.DataFrame.clip_upp
319319
generated/pandas.DataFrame.columns,../reference/api/pandas.DataFrame.columns
320320
generated/pandas.DataFrame.combine_first,../reference/api/pandas.DataFrame.combine_first
321321
generated/pandas.DataFrame.combine,../reference/api/pandas.DataFrame.combine
322-
generated/pandas.DataFrame.compound,../reference/api/pandas.DataFrame.compound
323322
generated/pandas.DataFrame.convert_objects,../reference/api/pandas.DataFrame.convert_objects
324323
generated/pandas.DataFrame.copy,../reference/api/pandas.DataFrame.copy
325324
generated/pandas.DataFrame.corr,../reference/api/pandas.DataFrame.corr
@@ -950,7 +949,6 @@ generated/pandas.Series.clip_lower,../reference/api/pandas.Series.clip_lower
950949
generated/pandas.Series.clip_upper,../reference/api/pandas.Series.clip_upper
951950
generated/pandas.Series.combine_first,../reference/api/pandas.Series.combine_first
952951
generated/pandas.Series.combine,../reference/api/pandas.Series.combine
953-
generated/pandas.Series.compound,../reference/api/pandas.Series.compound
954952
generated/pandas.Series.compress,../reference/api/pandas.Series.compress
955953
generated/pandas.Series.convert_objects,../reference/api/pandas.Series.convert_objects
956954
generated/pandas.Series.copy,../reference/api/pandas.Series.copy

doc/source/getting_started/10min.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ will be completed:
7575
df2.all df2.columns
7676
df2.any df2.combine
7777
df2.append df2.combine_first
78-
df2.apply df2.compound
79-
df2.applymap df2.consolidate
78+
df2.apply df2.consolidate
79+
df2.applymap
8080
df2.D
8181

8282
As you can see, the columns ``A``, ``B``, ``C``, and ``D`` are automatically

doc/source/reference/frame.rst

-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ Computations / descriptive stats
137137
DataFrame.all
138138
DataFrame.any
139139
DataFrame.clip
140-
DataFrame.compound
141140
DataFrame.corr
142141
DataFrame.corrwith
143142
DataFrame.count

doc/source/reference/series.rst

-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ Computations / descriptive stats
174174
Series.is_monotonic_increasing
175175
Series.is_monotonic_decreasing
176176
Series.value_counts
177-
Series.compound
178177

179178
Reindexing / selection / label manipulation
180179
-------------------------------------------

doc/source/user_guide/missing_data.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,15 +190,15 @@ The sum of an empty or all-NA Series or column of a DataFrame is 0.
190190
191191
pd.Series([np.nan]).sum()
192192
193-
pd.Series([]).sum()
193+
pd.Series([], dtype="float64").sum()
194194
195195
The product of an empty or all-NA Series or column of a DataFrame is 1.
196196

197197
.. ipython:: python
198198
199199
pd.Series([np.nan]).prod()
200200
201-
pd.Series([]).prod()
201+
pd.Series([], dtype="float64").prod()
202202
203203
204204
NA values in GroupBy

doc/source/user_guide/scale.rst

+1
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,7 @@ results will fit in memory, so we can safely call ``compute`` without running
358358
out of memory. At that point it's just a regular pandas object.
359359

360360
.. ipython:: python
361+
:okwarning:
361362
362363
@savefig dask_resample.png
363364
ddf[['x', 'y']].resample("1D").mean().cumsum().compute().plot()

doc/source/whatsnew/v0.19.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,7 @@ A ``Series`` will now correctly promote its dtype for assignment with incompat v
707707

708708

709709
.. ipython:: python
710+
:okwarning:
710711
711712
s = pd.Series()
712713

doc/source/whatsnew/v0.21.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ Note that this also changes the sum of an empty ``Series``. Previously this alwa
428428
but for consistency with the all-NaN case, this was changed to return NaN as well:
429429

430430
.. ipython:: python
431+
:okwarning:
431432
432433
pd.Series([]).sum()
433434

doc/source/whatsnew/v0.22.0.rst

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ The default sum for empty or all-*NA* ``Series`` is now ``0``.
5555
*pandas 0.22.0*
5656

5757
.. ipython:: python
58+
:okwarning:
5859
5960
pd.Series([]).sum()
6061
pd.Series([np.nan]).sum()
@@ -67,6 +68,7 @@ pandas 0.20.3 without bottleneck, or pandas 0.21.x), use the ``min_count``
6768
keyword.
6869

6970
.. ipython:: python
71+
:okwarning:
7072
7173
pd.Series([]).sum(min_count=1)
7274
@@ -85,6 +87,7 @@ required for a non-NA sum or product.
8587
returning ``1`` instead.
8688

8789
.. ipython:: python
90+
:okwarning:
8891
8992
pd.Series([]).prod()
9093
pd.Series([np.nan]).prod()

doc/source/whatsnew/v1.0.0.rst

+23-1
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,23 @@ When :class:`Categorical` contains ``np.nan``,
366366
367367
pd.Categorical([1, 2, np.nan], ordered=True).min()
368368
369+
370+
Default dtype of empty :class:`pandas.Series`
371+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
372+
373+
Initialising an empty :class:`pandas.Series` without specifying a dtype will raise a `DeprecationWarning` now
374+
(:issue:`17261`). The default dtype will change from ``float64`` to ``object`` in future releases so that it is
375+
consistent with the behaviour of :class:`DataFrame` and :class:`Index`.
376+
377+
*pandas 1.0.0*
378+
379+
.. code-block:: ipython
380+
381+
In [1]: pd.Series()
382+
Out[2]:
383+
DeprecationWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning.
384+
Series([], dtype: float64)
385+
369386
.. _whatsnew_1000.api_breaking.deps:
370387

371388
Increased minimum versions for dependencies
@@ -494,7 +511,7 @@ Removal of prior version deprecations/changes
494511

495512
Previously, pandas would register converters with matplotlib as a side effect of importing pandas (:issue:`18720`).
496513
This changed the output of plots made via matplotlib plots after pandas was imported, even if you were using
497-
matplotlib directly rather than rather than :meth:`~DataFrame.plot`.
514+
matplotlib directly rather than :meth:`~DataFrame.plot`.
498515

499516
To use pandas formatters with a matplotlib plot, specify
500517

@@ -518,11 +535,13 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
518535
- Removed the previously deprecated :meth:`Index.summary` (:issue:`18217`)
519536
- Removed the previously deprecated "fastpath" keyword from the :class:`Index` constructor (:issue:`23110`)
520537
- Removed the previously deprecated :meth:`Series.get_value`, :meth:`Series.set_value`, :meth:`DataFrame.get_value`, :meth:`DataFrame.set_value` (:issue:`17739`)
538+
- Removed the previously deprecated :meth:`Series.compound` and :meth:`DataFrame.compound` (:issue:`26405`)
521539
- Changed the the default value of `inplace` in :meth:`DataFrame.set_index` and :meth:`Series.set_axis`. It now defaults to ``False`` (:issue:`27600`)
522540
- Removed the previously deprecated :attr:`Series.cat.categorical`, :attr:`Series.cat.index`, :attr:`Series.cat.name` (:issue:`24751`)
523541
- Removed the previously deprecated ``time_rule`` keyword from (non-public) :func:`offsets.generate_range`, which has been moved to :func:`core.arrays._ranges.generate_range` (:issue:`24157`)
524542
- :meth:`DataFrame.loc` or :meth:`Series.loc` with listlike indexers and missing labels will no longer reindex (:issue:`17295`)
525543
- :meth:`DataFrame.to_excel` and :meth:`Series.to_excel` with non-existent columns will no longer reindex (:issue:`17295`)
544+
- :func:`concat` parameter "join_axes" has been removed, use ``reindex_like`` on the result instead (:issue:`22318`)
526545
- Removed the previously deprecated "by" keyword from :meth:`DataFrame.sort_index`, use :meth:`DataFrame.sort_values` instead (:issue:`10726`)
527546
- Removed support for nested renaming in :meth:`DataFrame.aggregate`, :meth:`Series.aggregate`, :meth:`DataFrameGroupBy.aggregate`, :meth:`SeriesGroupBy.aggregate`, :meth:`Rolling.aggregate` (:issue:`18529`)
528547
- Passing ``datetime64`` data to :class:`TimedeltaIndex` or ``timedelta64`` data to ``DatetimeIndex`` now raises ``TypeError`` (:issue:`23539`, :issue:`23937`)
@@ -585,6 +604,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
585604
- Removed the previously deprecated :meth:`Series.to_dense`, :meth:`DataFrame.to_dense` (:issue:`26684`)
586605
- Removed the previously deprecated :meth:`Index.dtype_str`, use ``str(index.dtype)`` instead (:issue:`27106`)
587606
- :meth:`Categorical.ravel` returns a :class:`Categorical` instead of a ``ndarray`` (:issue:`27199`)
607+
- The 'outer' method on Numpy ufuncs, e.g. ``np.subtract.outer`` operating on :class:`Series` objects is no longer supported, and will raise ``NotImplementedError`` (:issue:`27198`)
588608
- Removed previously deprecated :meth:`Series.get_dtype_counts` and :meth:`DataFrame.get_dtype_counts` (:issue:`27145`)
589609
- Changed the default ``fill_value`` in :meth:`Categorical.take` from ``True`` to ``False`` (:issue:`20841`)
590610
- Changed the default value for the `raw` argument in :func:`Series.rolling().apply() <pandas.core.window.Rolling.apply>`, :func:`DataFrame.rolling().apply() <pandas.core.window.Rolling.apply>`,
@@ -594,6 +614,7 @@ or ``matplotlib.Axes.plot``. See :ref:`plotting.formatters` for more.
594614
- Changed :meth:`Timedelta.resolution` to match the behavior of the standard library ``datetime.timedelta.resolution``, for the old behavior, use :meth:`Timedelta.resolution_string` (:issue:`26839`)
595615
- Removed previously deprecated :attr:`Timestamp.weekday_name`, :attr:`DatetimeIndex.weekday_name`, and :attr:`Series.dt.weekday_name` (:issue:`18164`)
596616
- Removed previously deprecated ``errors`` argument in :meth:`Timestamp.tz_localize`, :meth:`DatetimeIndex.tz_localize`, and :meth:`Series.tz_localize` (:issue:`22644`)
617+
- :meth:`Series.set_axis` and :meth:`DataFrame.set_axis` now require "labels" as the first argument and "axis" as an optional named parameter (:issue:`30089`)
597618
-
598619

599620
.. _whatsnew_1000.performance:
@@ -611,6 +632,7 @@ Performance improvements
611632
- Performance improvement when comparing a :class:`Categorical` with a scalar and the scalar is not found in the categories (:issue:`29750`)
612633
- Performance improvement when checking if values in a :class:`Categorical` are equal, equal or larger or larger than a given scalar.
613634
The improvement is not present if checking if the :class:`Categorical` is less than or less than or equal than the scalar (:issue:`29820`)
635+
- Performance improvement in :meth:`Index.equals` and :meth:`MultiIndex.equals` (:issue:`29134`)
614636

615637
.. _whatsnew_1000.bug_fixes:
616638

pandas/compat/pickle_compat.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __new__(cls) -> "Series": # type: ignore
6464
stacklevel=6,
6565
)
6666

67-
return Series()
67+
return Series(dtype=object)
6868

6969

7070
class _LoadSparseFrame:

0 commit comments

Comments
 (0)