Skip to content

Commit a4682bb

Browse files
committed
Merge branch 'main' into pandas-devgh-52343-timestamp-from-positional
2 parents 162bf90 + 3ce07cb commit a4682bb

File tree

100 files changed

+1738
-1279
lines changed

Some content is hidden

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

100 files changed

+1738
-1279
lines changed

.circleci/config.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: 2.1
33
jobs:
44
test-arm:
55
machine:
6-
image: ubuntu-2004:202101-01
6+
image: ubuntu-2004:2022.04.1
77
resource_class: arm.large
88
environment:
99
ENV_FILE: ci/deps/circle-38-arm64.yaml
@@ -23,7 +23,7 @@ jobs:
2323
cibw-build:
2424
type: string
2525
machine:
26-
image: ubuntu-2004:202101-01
26+
image: ubuntu-2004:2022.04.1
2727
resource_class: arm.large
2828
environment:
2929
ENV_FILE: ci/deps/circle-38-arm64.yaml
@@ -48,7 +48,7 @@ jobs:
4848
- run:
4949
name: Build aarch64 wheels
5050
command: |
51-
pip3 install cibuildwheel==2.9.0
51+
pip3 install cibuildwheel==2.12.1
5252
cibuildwheel --output-dir wheelhouse
5353
environment:
5454
CIBW_BUILD: << parameters.cibw-build >>
@@ -57,7 +57,7 @@ jobs:
5757
name: Install Anaconda Client & Upload Wheels
5858
command: |
5959
echo "Install Mambaforge"
60-
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/4.14.0-0/Mambaforge-4.14.0-0-Linux-aarch64.sh"
60+
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/23.1.0-0/Mambaforge-23.1.0-0-Linux-aarch64.sh"
6161
echo "Downloading $MAMBA_URL"
6262
wget -q $MAMBA_URL -O minimamba.sh
6363
chmod +x minimamba.sh

.circleci/setup_env.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash -e
22

33
echo "Install Mambaforge"
4-
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/4.14.0-0/Mambaforge-4.14.0-0-Linux-aarch64.sh"
4+
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/23.1.0-0/Mambaforge-23.1.0-0-Linux-aarch64.sh"
55
echo "Downloading $MAMBA_URL"
66
wget -q $MAMBA_URL -O minimamba.sh
77
chmod +x minimamba.sh

doc/source/development/contributing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ If using :ref:`mamba <contributing.mamba>`, do::
349349
If using :ref:`pip <contributing.pip>` , do::
350350

351351
# activate the virtual environment based on your platform
352-
pythom -m pip install --upgrade -r requirements-dev.txt
352+
python -m pip install --upgrade -r requirements-dev.txt
353353

354354
Tips for a successful pull request
355355
==================================

doc/source/development/maintaining.rst

+8-20
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ which will be triggered when the tag is pushed.
437437
git tag -a v1.5.0.dev0 -m "DEV: Start 1.5.0"
438438
git push upstream main --follow-tags
439439

440-
3. Build the source distribution (git must be in the tag commit):
440+
3. Build the source distribution (git must be in the tag commit)::
441441

442442
./setup.py sdist --formats=gztar --quiet
443443

@@ -455,25 +455,13 @@ which will be triggered when the tag is pushed.
455455
`automated conda-forge PR <https://github.com/conda-forge/pandas-feedstock/pulls>`_.
456456
Merge it once the CI is green, and it will generate the conda-forge packages.
457457

458-
6. Packages for supported versions in PyPI are built in the
459-
`MacPython repo <https://github.com/MacPython/pandas-wheels>`_.
460-
Open a PR updating the build commit to the released version, and merge it once the
461-
CI is green. To do this type::
462-
463-
git checkout master
464-
git pull --ff-only upstream master
465-
git checkout -B RLS-<version>
466-
sed -i 's/BUILD_COMMIT: "v.*/BUILD_COMMIT: "'v<version>'"/' azure/windows.yml azure/posix.yml
467-
sed -i 's/BUILD_COMMIT="v.*/BUILD_COMMIT="'v<version>'"/' .travis.yml
468-
git commit -am "RLS <version>"
469-
git push -u origin RLS-<version>
470-
471-
7. Download all wheels from the Anaconda repository where MacPython uploads them:
472-
https://anaconda.org/multibuild-wheels-staging/pandas/files?version=<version>
473-
to the ``dist/`` directory in the local pandas copy. You can use the script
474-
``scripts/download_wheels.sh`` to download all wheels at once.
475-
476-
8. Upload wheels to PyPI:
458+
6. Packages for supported versions in PyPI are built automatically from our CI.
459+
Once all packages are build download all wheels from the
460+
`Anaconda repository <https://anaconda.org/multibuild-wheels-staging/pandas/files?version=\<version\>>`_
461+
where our CI published them to the ``dist/`` directory in your local pandas copy.
462+
You can use the script ``scripts/download_wheels.sh`` to download all wheels at once.
463+
464+
7. Upload wheels to PyPI::
477465

478466
twine upload pandas/dist/pandas-<version>*.{whl,tar.gz} --skip-existing
479467

doc/source/development/roadmap.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ By replacing the BlockManager we hope to achieve
113113
* Improved micro-performance
114114
* Option to provide a C / Cython API to pandas' internals
115115

116-
See `these design documents <https://dev.pandas.io/pandas2/internal-architecture.html#removal-of-blockmanager-new-dataframe-internals>`__
116+
See `these design documents <https://wesm.github.io/pandas2/internal-architecture.html#removal-of-blockmanager-new-dataframe-internals>`__
117117
for more.
118118

119119
Decoupling of indexing and internals

doc/source/user_guide/basics.rst

-10
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,6 @@ You can test if a pandas object is empty, via the :attr:`~DataFrame.empty` prope
329329
df.empty
330330
pd.DataFrame(columns=list("ABC")).empty
331331
332-
To evaluate single-element pandas objects in a boolean context, use the method
333-
:meth:`~DataFrame.bool`:
334-
335-
.. ipython:: python
336-
337-
pd.Series([True]).bool()
338-
pd.Series([False]).bool()
339-
pd.DataFrame([[True]]).bool()
340-
pd.DataFrame([[False]]).bool()
341-
342332
.. warning::
343333

344334
You might be tempted to do the following:

doc/source/user_guide/gotchas.rst

-10
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,6 @@ Below is how to check if any of the values are ``True``:
121121
if pd.Series([False, True, False]).any():
122122
print("I am any")
123123
124-
To evaluate single-element pandas objects in a boolean context, use the method
125-
:meth:`~DataFrame.bool`:
126-
127-
.. ipython:: python
128-
129-
pd.Series([True]).bool()
130-
pd.Series([False]).bool()
131-
pd.DataFrame([[True]]).bool()
132-
pd.DataFrame([[False]]).bool()
133-
134124
Bitwise boolean
135125
~~~~~~~~~~~~~~~
136126

doc/source/whatsnew/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Version 2.0
2424
.. toctree::
2525
:maxdepth: 2
2626

27+
v2.0.1
2728
v2.0.0
2829

2930
Version 1.5

doc/source/whatsnew/v0.13.0.rst

+9-5
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,16 @@ API changes
153153
154154
Added the ``.bool()`` method to ``NDFrame`` objects to facilitate evaluating of single-element boolean Series:
155155

156-
.. ipython:: python
156+
.. code-block:: python
157157
158-
pd.Series([True]).bool()
159-
pd.Series([False]).bool()
160-
pd.DataFrame([[True]]).bool()
161-
pd.DataFrame([[False]]).bool()
158+
>>> pd.Series([True]).bool()
159+
True
160+
>>> pd.Series([False]).bool()
161+
False
162+
>>> pd.DataFrame([[True]]).bool()
163+
True
164+
>>> pd.DataFrame([[False]]).bool()
165+
False
162166
163167
- All non-Index NDFrames (``Series``, ``DataFrame``, ``Panel``, ``Panel4D``,
164168
``SparsePanel``, etc.), now support the entire set of arithmetic operators

doc/source/whatsnew/v2.0.0.rst

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _whatsnew_200:
22

3-
What's new in 2.0.0 (March XX, 2023)
4-
------------------------------------
3+
What's new in 2.0.0 (April 3, 2023)
4+
-----------------------------------
55

66
These are the changes in pandas 2.0.0. See :ref:`release` for a full changelog
77
including other versions of pandas.
@@ -66,7 +66,7 @@ Below is a possibly non-exhaustive list of changes:
6666
1. Instantiating using a numpy numeric array now follows the dtype of the numpy array.
6767
Previously, all indexes created from numpy numeric arrays were forced to 64-bit. Now,
6868
for example, ``Index(np.array([1, 2, 3]))`` will be ``int32`` on 32-bit systems, where
69-
it previously would have been ``int64``` even on 32-bit systems.
69+
it previously would have been ``int64`` even on 32-bit systems.
7070
Instantiating :class:`Index` using a list of numbers will still return 64bit dtypes,
7171
e.g. ``Index([1, 2, 3])`` will have a ``int64`` dtype, which is the same as previously.
7272
2. The various numeric datetime attributes of :class:`DatetimeIndex` (:attr:`~DatetimeIndex.day`,
@@ -95,7 +95,7 @@ Below is a possibly non-exhaustive list of changes:
9595
9696
4. :class:`Index` cannot be instantiated using a float16 dtype. Previously instantiating
9797
an :class:`Index` using dtype ``float16`` resulted in a :class:`Float64Index` with a
98-
``float64`` dtype. It row raises a ``NotImplementedError``:
98+
``float64`` dtype. It now raises a ``NotImplementedError``:
9999

100100
.. ipython:: python
101101
:okexcept:
@@ -717,7 +717,7 @@ In the past, :func:`to_datetime` guessed the format for each element independent
717717
Note that this affects :func:`read_csv` as well.
718718

719719
If you still need to parse dates with inconsistent formats, you can use
720-
``format='mixed`` (possibly alongside ``dayfirst``) ::
720+
``format='mixed'`` (possibly alongside ``dayfirst``) ::
721721

722722
ser = pd.Series(['13-01-2000', '12 January 2000'])
723723
pd.to_datetime(ser, format='mixed', dayfirst=True)

doc/source/whatsnew/v2.0.1.rst

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
.. _whatsnew_201:
2+
3+
What's new in 2.0.1 (May XX, 2023)
4+
----------------------------------
5+
6+
These are the changes in pandas 2.0.1. See :ref:`release` for a full changelog
7+
including other versions of pandas.
8+
9+
{{ header }}
10+
11+
.. ---------------------------------------------------------------------------
12+
.. _whatsnew_201.regressions:
13+
14+
Fixed regressions
15+
~~~~~~~~~~~~~~~~~
16+
-
17+
18+
.. ---------------------------------------------------------------------------
19+
.. _whatsnew_201.bug_fixes:
20+
21+
Bug fixes
22+
~~~~~~~~~
23+
-
24+
25+
.. ---------------------------------------------------------------------------
26+
.. _whatsnew_201.other:
27+
28+
Other
29+
~~~~~
30+
-
31+
32+
.. ---------------------------------------------------------------------------
33+
.. _whatsnew_201.contributors:
34+
35+
Contributors
36+
~~~~~~~~~~~~
37+
38+
.. contributors:: v2.0.0..v2.0.1|HEAD

doc/source/whatsnew/v2.1.0.rst

+56-6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,51 @@ enhancement1
2121

2222
.. _whatsnew_210.enhancements.enhancement2:
2323

24-
enhancement2
25-
^^^^^^^^^^^^
24+
``map(func, na_action="ignore")`` now works for all array types
25+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
26+
27+
When given a callable, :meth:`Series.map` applies the callable to all elements of the :class:`Series`.
28+
Similarly, :meth:`DataFrame.applymap` applies the callable to all elements of the :class:`DataFrame`,
29+
while :meth:`Index.map` applies the callable to all elements of the :class:`Index`.
30+
31+
Frequently, it is not desirable to apply the callable to nan-like values of the array and to avoid doing
32+
that, the ``map`` method could be called with ``na_action="ignore"``, i.e. ``ser.map(func, na_action="ignore")``.
33+
However, ``na_action="ignore"`` was not implemented for many ``ExtensionArray`` and ``Index`` types
34+
and ``na_action="ignore"`` did not work correctly for any ``ExtensionArray`` subclass except the nullable numeric ones (i.e. with dtype :class:`Int64` etc.).
35+
36+
``na_action="ignore"`` now works for all array types (:issue:`52219`, :issue:`51645`, :issue:`51809`, :issue:`51936`, :issue:`52033`; :issue:`52096`).
37+
38+
*Previous behavior*:
39+
40+
.. code-block:: ipython
41+
42+
In [1]: ser = pd.Series(["a", "b", np.nan], dtype="category")
43+
In [2]: ser.map(str.upper, na_action="ignore")
44+
NotImplementedError
45+
In [3]: df = pd.DataFrame(ser)
46+
In [4]: df.applymap(str.upper, na_action="ignore") # worked for DataFrame
47+
0
48+
0 A
49+
1 B
50+
2 NaN
51+
In [5]: idx = pd.Index(ser)
52+
In [6]: idx.map(str.upper, na_action="ignore")
53+
TypeError: CategoricalIndex.map() got an unexpected keyword argument 'na_action'
54+
55+
*New behavior*:
56+
57+
.. ipython:: python
58+
59+
ser = pd.Series(["a", "b", np.nan], dtype="category")
60+
ser.map(str.upper, na_action="ignore")
61+
df = pd.DataFrame(ser)
62+
df.applymap(str.upper, na_action="ignore")
63+
idx = pd.Index(ser)
64+
idx.map(str.upper, na_action="ignore")
65+
66+
Also, note that :meth:`Categorical.map` implicitly has had its ``na_action`` set to ``"ignore"`` by default.
67+
This has been deprecated and will :meth:`Categorical.map` in the future change the default
68+
to ``na_action=None``, like for all the other array types.
2669

2770
.. _whatsnew_210.enhancements.other:
2871

@@ -34,6 +77,7 @@ Other enhancements
3477
- Implemented ``__pandas_priority__`` to allow custom types to take precedence over :class:`DataFrame`, :class:`Series`, :class:`Index`, or :class:`ExtensionArray` for arithmetic operations, :ref:`see the developer guide <extending.pandas_priority>` (:issue:`48347`)
3578
- :meth:`MultiIndex.sort_values` now supports ``na_position`` (:issue:`51612`)
3679
- :meth:`MultiIndex.sortlevel` and :meth:`Index.sortlevel` gained a new keyword ``na_position`` (:issue:`51612`)
80+
- :meth:`arrays.DatetimeArray.map`, :meth:`arrays.TimedeltaArray.map` and :meth:`arrays.PeriodArray.map` can now take a ``na_action`` argument (:issue:`51644`)
3781
- Improve error message when setting :class:`DataFrame` with wrong number of columns through :meth:`DataFrame.isetitem` (:issue:`51701`)
3882
- Let :meth:`DataFrame.to_feather` accept a non-default :class:`Index` and non-string column names (:issue:`51787`)
3983
- :class:`api.extensions.ExtensionArray` now has a :meth:`~api.extensions.ExtensionArray.map` method (:issue:`51809`)
@@ -42,7 +86,6 @@ Other enhancements
4286
- Improved error message when creating a DataFrame with empty data (0 rows), no index and an incorrect number of columns. (:issue:`52084`)
4387
- :meth:`DataFrame.applymap` now uses the :meth:`~api.extensions.ExtensionArray.map` method of underlying :class:`api.extensions.ExtensionArray` instances (:issue:`52219`)
4488
- :meth:`arrays.SparseArray.map` now supports ``na_action`` (:issue:`52096`).
45-
- :meth:`Categorical.map` and :meth:`CategoricalIndex.map` now have a ``na_action`` parameter (:issue:`44279`)
4689
- Add dtype of categories to ``repr`` information of :class:`CategoricalDtype` (:issue:`52179`)
4790
-
4891

@@ -110,6 +153,7 @@ Deprecations
110153
- Deprecated :meth:`DataFrame._data` and :meth:`Series._data`, use public APIs instead (:issue:`33333`)
111154
- Deprecated :meth:`.Groupby.all` and :meth:`.GroupBy.any` with datetime64 or :class:`PeriodDtype` values, matching the :class:`Series` and :class:`DataFrame` deprecations (:issue:`34479`)
112155
- Deprecating pinning ``group.name`` to each group in :meth:`SeriesGroupBy.aggregate` aggregations; if your operation requires utilizing the groupby keys, iterate over the groupby object instead (:issue:`41090`)
156+
- Deprecated the behavior of :func:`concat` with both ``len(keys) != len(objs)``, in a future version this will raise instead of truncating to the shorter of the two sequences (:issue:`43485`)
113157
- Deprecated the default of ``observed=False`` in :meth:`DataFrame.groupby` and :meth:`Series.groupby`; this will default to ``True`` in a future version (:issue:`43999`)
114158
- Deprecated explicit support for subclassing :class:`Index` (:issue:`45289`)
115159
- Deprecated :meth:`DataFrameGroupBy.dtypes`, check ``dtypes`` on the underlying object instead (:issue:`51045`)
@@ -125,10 +169,12 @@ Deprecations
125169
- Deprecated the 'axis' keyword in :meth:`.GroupBy.idxmax`, :meth:`.GroupBy.idxmin`, :meth:`.GroupBy.fillna`, :meth:`.GroupBy.take`, :meth:`.GroupBy.skew`, :meth:`.GroupBy.rank`, :meth:`.GroupBy.cumprod`, :meth:`.GroupBy.cumsum`, :meth:`.GroupBy.cummax`, :meth:`.GroupBy.cummin`, :meth:`.GroupBy.pct_change`, :meth:`GroupBy.diff`, :meth:`.GroupBy.shift`, and :meth:`DataFrameGroupBy.corrwith`; for ``axis=1`` operate on the underlying :class:`DataFrame` instead (:issue:`50405`, :issue:`51046`)
126170
- Deprecated passing a dictionary to :meth:`.SeriesGroupBy.agg`; pass a list of aggregations instead (:issue:`50684`)
127171
- Deprecated logical operations (``|``, ``&``, ``^``) between pandas objects and dtype-less sequences (e.g. ``list``, ``tuple``), wrap a sequence in a :class:`Series` or numpy array before operating instead (:issue:`51521`)
172+
- Deprecated the methods :meth:`Series.bool` and :meth:`DataFrame.bool` (:issue:`51749`)
128173
- Deprecated :meth:`DataFrame.swapaxes` and :meth:`Series.swapaxes`, use :meth:`DataFrame.transpose` or :meth:`Series.transpose` instead (:issue:`51946`)
129174
- Deprecated parameter ``convert_type`` in :meth:`Series.apply` (:issue:`52140`)
130175
-
131176

177+
132178
.. ---------------------------------------------------------------------------
133179
.. _whatsnew_210.performance:
134180

@@ -148,6 +194,8 @@ Performance improvements
148194
- Performance improvement in :meth:`Series.combine_first` (:issue:`51777`)
149195
- Performance improvement in :meth:`MultiIndex.set_levels` and :meth:`MultiIndex.set_codes` when ``verify_integrity=True`` (:issue:`51873`)
150196
- Performance improvement in :func:`factorize` for object columns not containing strings (:issue:`51921`)
197+
- Performance improvement in :class:`Series` reductions (:issue:`52341`)
198+
-
151199

152200
.. ---------------------------------------------------------------------------
153201
.. _whatsnew_210.bug_fixes:
@@ -163,7 +211,7 @@ Categorical
163211
Datetimelike
164212
^^^^^^^^^^^^
165213
- Bug in :meth:`Timestamp.round` with values close to the implementation bounds returning incorrect results instead of raising ``OutOfBoundsDatetime`` (:issue:`51494`)
166-
- :meth:`arrays.DatetimeArray.map` can now take a ``na_action`` argument. :meth:`DatetimeIndex.map` with ``na_action="ignore"`` now works as expected. (:issue:`51644`)
214+
- :meth:`DatetimeIndex.map` with ``na_action="ignore"`` now works as expected. (:issue:`51644`)
167215
- Bug in :meth:`arrays.DatetimeArray.map` and :meth:`DatetimeIndex.map`, where the supplied callable operated array-wise instead of element-wise (:issue:`51977`)
168216
- Bug in :class:`Timestamp` raising an error when passing fold when constructing from positional arguments.
169217
- Bug in :class:`Timestamp` leading to inconsistent timestamps when passing arguments as positional versus as a keyword.
@@ -173,7 +221,7 @@ Timedelta
173221
^^^^^^^^^
174222
- Bug in :meth:`Timedelta.round` with values close to the implementation bounds returning incorrect results instead of raising ``OutOfBoundsTimedelta`` (:issue:`51494`)
175223
- Bug in :class:`TimedeltaIndex` division or multiplication leading to ``.freq`` of "0 Days" instead of ``None`` (:issue:`51575`)
176-
- :meth:`arrays.TimedeltaArray.map` can now take a ``na_action`` argument. :meth:`TimedeltaIndex.map` with ``na_action="ignore"`` now works as expected. (:issue:`51644`)
224+
- :meth:`TimedeltaIndex.map` with ``na_action="ignore"`` now works as expected (:issue:`51644`)
177225
- Bug in :meth:`arrays.TimedeltaArray.map` and :meth:`TimedeltaIndex.map`, where the supplied callable operated array-wise instead of element-wise (:issue:`51977`)
178226
-
179227

@@ -229,7 +277,7 @@ I/O
229277
Period
230278
^^^^^^
231279
- Bug in :class:`PeriodDtype` constructor failing to raise ``TypeError`` when no argument is passed or when ``None`` is passed (:issue:`27388`)
232-
- :meth:`arrays.PeriodArray.map` can now take a ``na_action`` argument. :meth:`PeriodIndex.map` with ``na_action="ignore"`` now works as expected. (:issue:`51644`)
280+
- :meth:`PeriodIndex.map` with ``na_action="ignore"`` now works as expected (:issue:`51644`)
233281
- Bug in :class:`PeriodDtype` constructor raising ``ValueError`` instead of ``TypeError`` when an invalid type is passed (:issue:`51790`)
234282
- Bug in :meth:`arrays.PeriodArray.map` and :meth:`PeriodIndex.map`, where the supplied callable operated array-wise instead of element-wise (:issue:`51977`)
235283
-
@@ -276,6 +324,8 @@ Other
276324
^^^^^
277325
- Bug in :func:`assert_almost_equal` now throwing assertion error for two unequal sets (:issue:`51727`)
278326
- Bug in :meth:`Series.memory_usage` when ``deep=True`` throw an error with Series of objects and the returned value is incorrect, as it does not take into account GC corrections (:issue:`51858`)
327+
- Bug in :func:`assert_frame_equal` checks category dtypes even when asked not to check index type (:issue:`52126`)
328+
- Bug in :meth:`Series.map` when giving a callable to an empty series, the returned series had ``object`` dtype. It now keeps the original dtype (:issue:`52384`)
279329

280330
.. ***DO NOT USE THIS SECTION***
281331

0 commit comments

Comments
 (0)