Skip to content

Commit

Permalink
Merge branch '2.1.x' into backport_rank
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl authored Oct 15, 2023
2 parents 6fcea5f + 0ee6fc9 commit 9ce658f
Show file tree
Hide file tree
Showing 27 changed files with 53 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build_pandas/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ runs:
- name: Build Pandas
run: |
if [[ ${{ inputs.editable }} == "true" ]]; then
pip install -e . --no-build-isolation -v
pip install -e . --no-build-isolation -v --no-deps
else
pip install . --no-build-isolation -v
pip install . --no-build-isolation -v --no-deps
fi
shell: bash -el {0}
2 changes: 1 addition & 1 deletion .github/workflows/docbuild-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
run: cp doc/cheatsheet/Pandas_Cheat_Sheet* web/build/

- name: Upload web
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' web/build/ web@${{ secrets.server_ip }}:/var/www/html
run: rsync -az --delete --exclude='pandas-docs' --exclude='docs' --exclude='benchmarks' web/build/ web@${{ secrets.server_ip }}:/var/www/html
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

- name: Upload dev docs
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ jobs:
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson[ninja]==1.2.1 meson-python==0.13.1
python -m pip install numpy --config-settings=setup-args="-Dallow-noblas=true"
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] "cython<3.0.3" python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e .
python -m pip list --no-cache-dir
export PANDAS_CI=1
Expand Down Expand Up @@ -274,7 +274,7 @@ jobs:
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/virtualenvs/pandas-dev/bin/activate
python -m pip install --no-cache-dir -U pip wheel setuptools meson-python==0.13.1 meson[ninja]==1.2.1
python -m pip install --no-cache-dir versioneer[toml] cython numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python -m pip install --no-cache-dir versioneer[toml] "cython<3.0.3" numpy python-dateutil pytz pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-asyncio>=0.17 hypothesis>=6.46.1
python -m pip install --no-cache-dir --no-build-isolation -e .
python -m pip list --no-cache-dir
Expand Down Expand Up @@ -347,8 +347,8 @@ jobs:
python -m pip install --upgrade pip setuptools wheel meson[ninja]==1.2.1 meson-python==0.13.1
python -m pip install --pre --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple numpy
python -m pip install versioneer[toml]
python -m pip install python-dateutil pytz tzdata cython hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov pytest-asyncio>=0.17
python -m pip install -ve . --no-build-isolation --no-index
python -m pip install python-dateutil pytz tzdata "cython<3.0.3" hypothesis>=6.46.1 pytest>=7.3.2 pytest-xdist>=2.2.0 pytest-cov pytest-asyncio>=0.17
python -m pip install -ve . --no-build-isolation --no-index --no-deps
python -m pip list
- name: Run Tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ jobs:
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"

- name: Build wheels
uses: pypa/[email protected].1
uses: pypa/[email protected].2
with:
package-dir: ./dist/${{ matrix.buildplat[1] == 'macosx_*' && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
env:
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -20,7 +20,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz

# optional dependencies
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-311-downstream_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -21,7 +21,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz

# optional dependencies
Expand Down
2 changes: 1 addition & 1 deletion ci/deps/actions-311-numpydev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- versioneer[toml]
- meson[ninja]=1.2.1
- meson-python=0.13.1
- cython>=0.29.33
- cython>=0.29.33, <3.0.3

# test dependencies
- pytest>=7.3.2
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-311-pyarrownightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dependencies:
# build dependencies
- versioneer[toml]
- meson[ninja]=1.2.1
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson-python=0.13.1

# test dependencies
Expand All @@ -19,7 +19,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz
- pip

Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -20,7 +20,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz

# optional dependencies
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-39-minimum_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -22,7 +22,7 @@ dependencies:

# required dependencies
- python-dateutil=2.8.2
- numpy=1.22.4
- numpy=1.22.4, <2
- pytz=2020.1

# optional dependencies
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -20,7 +20,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz

# optional dependencies
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/actions-pypy-39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -21,7 +21,7 @@ dependencies:
- hypothesis>=6.46.1

# required
- numpy
- numpy<2
- python-dateutil
- pytz
- pip:
Expand Down
4 changes: 2 additions & 2 deletions ci/deps/circle-310-arm64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ dependencies:

# build dependencies
- versioneer[toml]
- cython>=0.29.33
- cython>=0.29.33, <3.0.3
- meson[ninja]=1.2.1
- meson-python=0.13.1

Expand All @@ -20,7 +20,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz

# optional dependencies
Expand Down
1 change: 1 addition & 0 deletions doc/source/whatsnew/v2.1.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Bug fixes
- Fixed bug in :meth:`DataFrame.idxmin` and :meth:`DataFrame.idxmax` raising for arrow dtypes (:issue:`55368`)
- Fixed bug in :meth:`DataFrame.interpolate` raising incorrect error message (:issue:`55347`)
- Fixed bug in :meth:`Index.insert` raising when inserting ``None`` into :class:`Index` with ``dtype="string[pyarrow_numpy]"`` (:issue:`55365`)
- Fixed bug in :meth:`Series.all` and :meth:`Series.any` not treating missing values correctly for ``dtype="string[pyarrow_numpy]"`` (:issue:`55367`)
- Fixed bug in :meth:`Series.rank` for ``string[pyarrow_numpy]`` dtype (:issue:`55362`)
- Silence ``Period[B]`` warnings introduced by :issue:`53446` during normal plotting activity (:issue:`55138`)
-
Expand Down
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ dependencies:

# required dependencies
- python-dateutil
- numpy
- numpy<2
- pytz

# optional dependencies
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/arrays/string_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -601,9 +601,11 @@ def _reduce(
self, name: str, *, skipna: bool = True, keepdims: bool = False, **kwargs
):
if name in ["any", "all"]:
arr = pc.and_kleene(
pc.invert(pc.is_null(self._pa_array)), pc.not_equal(self._pa_array, "")
)
if not skipna and name == "all":
nas = pc.invert(pc.is_null(self._pa_array))
arr = pc.and_kleene(nas, pc.not_equal(self._pa_array, ""))
else:
arr = pc.not_equal(self._pa_array, "")
return ArrowExtensionArray(arr)._reduce(
name, skipna=skipna, keepdims=keepdims, **kwargs
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ def __init__(self) -> None:
# with a label, but the underlying variable is -127 to 100
# we're going to drop the label and cast to int
self.DTYPE_MAP = dict(
list(zip(range(1, 245), [np.dtype("a" + str(i)) for i in range(1, 245)]))
[(i, np.dtype(f"S{i}")) for i in range(1, 245)]
+ [
(251, np.dtype(np.int8)),
(252, np.dtype(np.int16)),
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/constructors/test_from_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def test_frame_from_records_utc(self):

def test_from_records_to_records(self):
# from numpy documentation
arr = np.zeros((2,), dtype=("i4,f4,a10"))
arr = np.zeros((2,), dtype=("i4,f4,S10"))
arr[:] = [(1, 2.0, "Hello"), (2, 3.0, "World")]

DataFrame.from_records(arr)
Expand Down
4 changes: 1 addition & 3 deletions pandas/tests/frame/methods/test_select_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,7 @@ def test_select_dtypes_datetime_with_tz(self):
expected = df3.reindex(columns=[])
tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize(
"dtype", [str, "str", np.bytes_, "S1", "unicode", np.str_, "U1"]
)
@pytest.mark.parametrize("dtype", [str, "str", np.bytes_, "S1", np.str_, "U1"])
@pytest.mark.parametrize("arg", ["include", "exclude"])
def test_select_dtypes_str_raises(self, dtype, arg):
df = DataFrame(
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/methods/test_to_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ def test_to_records_with_categorical(self):
),
# Pass in a dtype instance.
(
{"column_dtypes": np.dtype("unicode")},
{"column_dtypes": np.dtype(np.str_)},
np.rec.array(
[("0", "1", "0.2", "a"), ("1", "2", "1.5", "bc")],
dtype=[
Expand Down
10 changes: 5 additions & 5 deletions pandas/tests/indexes/base_class/test_setops.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,23 +182,23 @@ def test_symmetric_difference(self):
"intersection",
np.array(
[(1, "A"), (2, "A"), (1, "B"), (2, "B")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
),
False,
),
(
"intersection",
np.array(
[(1, "A"), (1, "B"), (2, "A"), (2, "B")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
),
None,
),
(
"union",
np.array(
[(1, "A"), (1, "B"), (1, "C"), (2, "A"), (2, "B"), (2, "C")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
),
None,
),
Expand All @@ -208,13 +208,13 @@ def test_tuple_union_bug(self, method, expected, sort):
index1 = Index(
np.array(
[(1, "A"), (2, "A"), (1, "B"), (2, "B")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
)
)
index2 = Index(
np.array(
[(1, "A"), (2, "A"), (1, "B"), (2, "B"), (1, "C"), (2, "C")],
dtype=[("num", int), ("let", "a1")],
dtype=[("num", int), ("let", "S1")],
)
)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ def test_blocks_compat_GH9037(self):
)

# JSON deserialisation always creates unicode strings
df_mixed.columns = df_mixed.columns.astype("unicode")
df_mixed.columns = df_mixed.columns.astype(np.str_)
data = StringIO(df_mixed.to_json(orient="split"))
df_roundtrip = read_json(data, orient="split")
tm.assert_frame_equal(
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/reductions/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,8 @@ def test_any_all_pyarrow_string(self):

ser = Series([None, "a"], dtype="string[pyarrow_numpy]")
assert ser.any()
assert not ser.all()
assert ser.all()
assert not ser.all(skipna=False)

ser = Series([None, ""], dtype="string[pyarrow_numpy]")
assert not ser.any()
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/reshape/concat/test_append.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ def test_append_length0_frame(self, sort):
tm.assert_frame_equal(df5, expected)

def test_append_records(self):
arr1 = np.zeros((2,), dtype=("i4,f4,a10"))
arr1 = np.zeros((2,), dtype=("i4,f4,S10"))
arr1[:] = [(1, 2.0, "Hello"), (2, 3.0, "World")]

arr2 = np.zeros((3,), dtype=("i4,f4,a10"))
arr2 = np.zeros((3,), dtype=("i4,f4,S10"))
arr2[:] = [(3, 4.0, "foo"), (5, 6.0, "bar"), (7.0, 8.0, "baz")]

df1 = DataFrame(arr1)
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/series/methods/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@ def test_astype_unicode(self):
# bytes with obj.decode() instead of str(obj)
item = "野菜食べないとやばい"
ser = Series([item.encode()])
result = ser.astype("unicode")
result = ser.astype(np.str_)
expected = Series([item])
tm.assert_series_equal(result, expected)

for ser in test_series:
res = ser.astype("unicode")
res = ser.astype(np.str_)
expec = ser.map(str)
tm.assert_series_equal(res, expec)

Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ requires = [
# we don't want to force users to compile with 1.25 though
# (Ideally, in the future, though, oldest-supported-numpy can be dropped when our min numpy is 1.25.x)
"oldest-supported-numpy>=2022.8.16; python_version<'3.12'",
"numpy>=1.26.0; python_version>='3.12'",
"numpy>=1.26.0,<2; python_version>='3.12'",
"versioneer[toml]"
]

Expand All @@ -29,9 +29,9 @@ authors = [
license = {file = 'LICENSE'}
requires-python = '>=3.9'
dependencies = [
"numpy>=1.22.4; python_version<'3.11'",
"numpy>=1.23.2; python_version=='3.11'",
"numpy>=1.26.0; python_version>='3.12'",
"numpy>=1.22.4,<2; python_version<'3.11'",
"numpy>=1.23.2,<2; python_version=='3.11'",
"numpy>=1.26.0,<2; python_version>='3.12'",
"python-dateutil>=2.8.2",
"pytz>=2020.1",
"tzdata>=2022.1"
Expand Down
Loading

0 comments on commit 9ce658f

Please sign in to comment.