Skip to content

Commit 1b8e4db

Browse files
committed
Merge branch '1.5.x' of https://github.com/pandas-dev/pandas into 1.5.x
2 parents 3f6b0e4 + c9252cf commit 1b8e4db

File tree

33 files changed

+454
-59
lines changed

33 files changed

+454
-59
lines changed

.github/workflows/32-bit-linux.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
branches:
66
- main
77
- 1.5.x
8-
- 1.4.x
98
pull_request:
109
branches:
1110
- main
1211
- 1.5.x
13-
- 1.4.x
1412
paths-ignore:
1513
- "doc/**"
1614

.github/workflows/code-checks.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
branches:
66
- main
77
- 1.5.x
8-
- 1.4.x
98
pull_request:
109
branches:
1110
- main
1211
- 1.5.x
13-
- 1.4.x
1412

1513
env:
1614
ENV_FILE: environment.yml

.github/workflows/docbuild-and-upload.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ on:
55
branches:
66
- main
77
- 1.5.x
8-
- 1.4.x
98
tags:
109
- '*'
1110
pull_request:
1211
branches:
1312
- main
1413
- 1.5.x
15-
- 1.4.x
1614

1715
env:
1816
ENV_FILE: environment.yml
@@ -66,22 +64,22 @@ jobs:
6664
mkdir -m 700 -p ~/.ssh
6765
echo "${{ secrets.server_ssh_key }}" > ~/.ssh/id_rsa
6866
chmod 600 ~/.ssh/id_rsa
69-
echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBE1Kkopomm7FHG5enATf7SgnpICZ4W2bw+Ho+afqin+w7sMcrsa0je7sbztFAV8YchDkiBKnWTG4cRT+KZgZCaY=" > ~/.ssh/known_hosts
67+
echo "${{ secrets.server_ip }} ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBFjYkJBk7sos+r7yATODogQc3jUdW1aascGpyOD4bohj8dWjzwLJv/OJ/fyOQ5lmj81WKDk67tGtqNJYGL9acII=" > ~/.ssh/known_hosts
7068
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))
7169

7270
- name: Copy cheatsheets into site directory
7371
run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/
7472

7573
- name: Upload web
76-
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' web/build/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas
74+
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' web/build/ web@${{ secrets.server_ip }}:/var/www/html
7775
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
7876

7977
- name: Upload dev docs
80-
run: rsync -az --delete doc/build/html/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas/pandas-docs/dev
78+
run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/dev
8179
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
8280

8381
- name: Upload prod docs
84-
run: rsync -az --delete doc/build/html/ docs@${{ secrets.server_ip }}:/usr/share/nginx/pandas/pandas-docs/version/${GITHUB_REF_NAME:1}
82+
run: rsync -az --delete doc/build/html/ web@${{ secrets.server_ip }}:/var/www/html/pandas-docs/version/${GITHUB_REF_NAME:1}
8583
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
8684

8785
- name: Move docs into site directory

.github/workflows/macos-windows.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
branches:
66
- main
77
- 1.5.x
8-
- 1.4.x
98
pull_request:
109
branches:
1110
- main
1211
- 1.5.x
13-
- 1.4.x
1412
paths-ignore:
1513
- "doc/**"
1614

.github/workflows/python-dev.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,10 @@ on:
2525
branches:
2626
- main
2727
- 1.5.x
28-
- 1.4.x
2928
pull_request:
3029
branches:
3130
- main
3231
- 1.5.x
33-
- 1.4.x
3432
paths-ignore:
3533
- "doc/**"
3634

.github/workflows/sdist.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
branches:
66
- main
77
- 1.5.x
8-
- 1.4.x
98
pull_request:
109
branches:
1110
- main
1211
- 1.5.x
13-
- 1.4.x
1412
types: [labeled, opened, synchronize, reopened]
1513
paths-ignore:
1614
- "doc/**"
@@ -30,7 +28,7 @@ jobs:
3028
strategy:
3129
fail-fast: false
3230
matrix:
33-
python-version: ["3.8", "3.9", "3.10"]
31+
python-version: ["3.8", "3.9", "3.10", "3.11"]
3432
concurrency:
3533
# https://github.community/t/concurrecy-not-work-for-push/183068/7
3634
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{matrix.python-version}}-sdist
@@ -42,7 +40,7 @@ jobs:
4240
fetch-depth: 0
4341

4442
- name: Set up Python
45-
uses: actions/setup-python@v3
43+
uses: actions/setup-python@v4
4644
with:
4745
python-version: ${{ matrix.python-version }}
4846

@@ -86,6 +84,8 @@ jobs:
8684
pip install numpy==1.20.3 ;;
8785
3.10)
8886
pip install numpy==1.21.2 ;;
87+
3.11)
88+
pip install numpy==1.23.2 ;;
8989
esac
9090
9191
- name: Import pandas

.github/workflows/ubuntu.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ on:
55
branches:
66
- main
77
- 1.5.x
8-
- 1.4.x
98
pull_request:
109
branches:
1110
- main
1211
- 1.5.x
13-
- 1.4.x
1412
paths-ignore:
1513
- "doc/**"
1614

doc/source/development/contributing_environment.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ To test out code changes, you'll need to build pandas from source, which
1010
requires a C/C++ compiler and Python environment. If you're making documentation
1111
changes, you can skip to :ref:`contributing to the documentation <contributing_documentation>` but if you skip
1212
creating the development environment you won't be able to build the documentation
13-
locally before pushing your changes.
13+
locally before pushing your changes. It's recommended to also install the :ref:`pre-commit hooks <contributing.pre-commit>`.
1414

1515
.. contents:: Table of contents:
1616
:local:

doc/source/getting_started/install.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Instructions for installing from source,
2020
Python version support
2121
----------------------
2222

23-
Officially Python 3.8, 3.9 and 3.10.
23+
Officially Python 3.8, 3.9, 3.10 and 3.11.
2424

2525
Installing pandas
2626
-----------------

doc/source/whatsnew/v0.13.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ Enhancements
733733
734734
.. _scipy: http://www.scipy.org
735735
.. _documentation: http://docs.scipy.org/doc/scipy/reference/interpolate.html#univariate-interpolation
736-
.. _guide: http://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html
736+
.. _guide: https://docs.scipy.org/doc/scipy/tutorial/interpolate.html
737737

738738
- ``to_csv`` now takes a ``date_format`` keyword argument that specifies how
739739
output datetime objects should be formatted. Datetimes encountered in the

doc/source/whatsnew/v1.5.2.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ including other versions of pandas.
1313

1414
Fixed regressions
1515
~~~~~~~~~~~~~~~~~
16-
-
16+
- Fixed regression in :meth:`MultiIndex.join` for extension array dtypes (:issue:`49277`)
17+
- Fixed regression in :meth:`Series.replace` raising ``RecursionError`` with numeric dtype and when specifying ``value=None`` (:issue:`45725`)
18+
- Fixed regression in :meth:`DataFrame.plot` preventing :class:`~matplotlib.colors.Colormap` instance
19+
from being passed using the ``colormap`` argument if Matplotlib 3.6+ is used (:issue:`49374`)
20+
- Fixed regression in :func:`date_range` returning an invalid set of periods for ``CustomBusinessDay`` frequency and ``start`` date with timezone (:issue:`49441`)
1721
-
1822

1923
.. ---------------------------------------------------------------------------
2024
.. _whatsnew_152.bug_fixes:
2125

2226
Bug fixes
2327
~~~~~~~~~
24-
-
28+
- Bug in the Copy-on-Write implementation losing track of views in certain chained indexing cases (:issue:`48996`)
2529
-
2630

2731
.. ---------------------------------------------------------------------------

pandas/_libs/internals.pyx

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,9 @@ cdef class BlockManager:
676676
public bint _known_consolidated, _is_consolidated
677677
public ndarray _blknos, _blklocs
678678
public list refs
679+
public object parent
679680

680-
def __cinit__(self, blocks=None, axes=None, refs=None, verify_integrity=True):
681+
def __cinit__(self, blocks=None, axes=None, refs=None, parent=None, verify_integrity=True):
681682
# None as defaults for unpickling GH#42345
682683
if blocks is None:
683684
# This adds 1-2 microseconds to DataFrame(np.array([]))
@@ -690,6 +691,7 @@ cdef class BlockManager:
690691
self.blocks = blocks
691692
self.axes = axes.copy() # copy to make sure we are not remotely-mutable
692693
self.refs = refs
694+
self.parent = parent
693695

694696
# Populate known_consolidate, blknos, and blklocs lazily
695697
self._known_consolidated = False
@@ -805,7 +807,9 @@ cdef class BlockManager:
805807
nrefs.append(weakref.ref(blk))
806808

807809
new_axes = [self.axes[0], self.axes[1]._getitem_slice(slobj)]
808-
mgr = type(self)(tuple(nbs), new_axes, nrefs, verify_integrity=False)
810+
mgr = type(self)(
811+
tuple(nbs), new_axes, nrefs, parent=self, verify_integrity=False
812+
)
809813

810814
# We can avoid having to rebuild blklocs/blknos
811815
blklocs = self._blklocs
@@ -827,4 +831,6 @@ cdef class BlockManager:
827831
new_axes = list(self.axes)
828832
new_axes[axis] = new_axes[axis]._getitem_slice(slobj)
829833

830-
return type(self)(tuple(new_blocks), new_axes, new_refs, verify_integrity=False)
834+
return type(self)(
835+
tuple(new_blocks), new_axes, new_refs, parent=self, verify_integrity=False
836+
)

pandas/_libs/tslibs/offsets.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,9 @@ cdef _to_dt64D(dt):
258258
if getattr(dt, 'tzinfo', None) is not None:
259259
# Get the nanosecond timestamp,
260260
# equiv `Timestamp(dt).value` or `dt.timestamp() * 10**9`
261-
naive = dt.astimezone(None)
261+
# The `naive` must be the `dt` naive wall time
262+
# instead of the naive absolute time (GH#49441)
263+
naive = dt.replace(tzinfo=None)
262264
dt = np.datetime64(naive, "D")
263265
else:
264266
dt = np.datetime64(dt)

pandas/core/frame.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
function as nv,
8787
np_percentile_argname,
8888
)
89+
from pandas.errors import InvalidIndexError
8990
from pandas.util._decorators import (
9091
Appender,
9192
Substitution,
@@ -4220,6 +4221,13 @@ def _set_value(
42204221
self.loc[index, col] = value
42214222
self._item_cache.pop(col, None)
42224223

4224+
except InvalidIndexError as ii_err:
4225+
# GH48729: Seems like you are trying to assign a value to a
4226+
# row when only scalar options are permitted
4227+
raise InvalidIndexError(
4228+
f"You can only assign a scalar value not a {type(value)}"
4229+
) from ii_err
4230+
42234231
def _ensure_valid_index(self, value) -> None:
42244232
"""
42254233
Ensure that if we don't have an index, that we can create one from the

pandas/core/indexes/base.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4701,8 +4701,10 @@ def join(
47014701
return self._join_non_unique(other, how=how)
47024702
elif not self.is_unique or not other.is_unique:
47034703
if self.is_monotonic_increasing and other.is_monotonic_increasing:
4704-
if self._can_use_libjoin:
4704+
if not is_interval_dtype(self.dtype):
47054705
# otherwise we will fall through to _join_via_get_indexer
4706+
# GH#39133
4707+
# go through object dtype for ea till engine is supported properly
47064708
return self._join_monotonic(other, how=how)
47074709
else:
47084710
return self._join_non_unique(other, how=how)
@@ -5079,7 +5081,7 @@ def _wrap_joined_index(self: _IndexT, joined: ArrayLike, other: _IndexT) -> _Ind
50795081
return self._constructor(joined, name=name) # type: ignore[return-value]
50805082
else:
50815083
name = get_op_result_name(self, other)
5082-
return self._constructor._with_infer(joined, name=name)
5084+
return self._constructor._with_infer(joined, name=name, dtype=self.dtype)
50835085

50845086
@cache_readonly
50855087
def _can_use_libjoin(self) -> bool:

pandas/core/internals/blocks.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,6 @@ def replace(
569569
# Note: the checks we do in NDFrame.replace ensure we never get
570570
# here with listlike to_replace or value, as those cases
571571
# go through replace_list
572-
573572
values = self.values
574573

575574
if isinstance(values, Categorical):
@@ -608,7 +607,10 @@ def replace(
608607
return blocks
609608

610609
elif self.ndim == 1 or self.shape[0] == 1:
611-
blk = self.coerce_to_target_dtype(value)
610+
if value is None:
611+
blk = self.astype(np.dtype(object))
612+
else:
613+
blk = self.coerce_to_target_dtype(value)
612614
return blk.replace(
613615
to_replace=to_replace,
614616
value=value,

0 commit comments

Comments
 (0)