Skip to content

Commit 8ff3925

Browse files
authored
Merge branch 'main' into docs_pandas.api.indexers.VariableOffsetWindowIndexer
2 parents a929f42 + 3b447d6 commit 8ff3925

File tree

21 files changed

+164
-122
lines changed

21 files changed

+164
-122
lines changed

.circleci/config.yml

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ jobs:
1515
- checkout
1616
- run:
1717
name: Install Environment and Run Tests
18-
shell: /bin/bash -exuo pipefail
18+
shell: /bin/bash -exo pipefail
19+
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd
1920
command: |
20-
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-Linux-aarch64.sh"
21-
wget -q $MAMBA_URL -O minimamba.sh
22-
chmod +x minimamba.sh
23-
MAMBA_DIR="$HOME/miniconda3"
24-
rm -rf $MAMBA_DIR
25-
./minimamba.sh -b -p $MAMBA_DIR
26-
export PATH=$MAMBA_DIR/bin:$PATH
21+
MINI_URL="https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Miniforge3-24.3.0-0-Linux-aarch64.sh"
22+
wget -q $MINI_URL -O Miniforge3.sh
23+
chmod +x Miniforge3.sh
24+
MINI_DIR="$HOME/miniconda3"
25+
rm -rf $MINI_DIR
26+
./Miniforge3.sh -b -p $MINI_DIR
27+
export PATH=$MINI_DIR/bin:$PATH
2728
conda info -a
2829
conda env create -q -n pandas-dev -f $ENV_FILE
2930
conda list -n pandas-dev
@@ -33,6 +34,7 @@ jobs:
3334
fi
3435
python -m pip install --no-build-isolation -ve . --config-settings=setup-args="--werror"
3536
PATH=$HOME/miniconda3/envs/pandas-dev/bin:$HOME/miniconda3/condabin:$PATH
37+
sudo apt-get update && sudo apt-get install -y libegl1 libopengl0
3638
ci/run_tests.sh
3739
test-linux-musl:
3840
docker:
@@ -97,21 +99,16 @@ jobs:
9799

98100
- run:
99101
name: Install Anaconda Client & Upload Wheels
102+
shell: /bin/bash -exo pipefail
100103
command: |
101-
echo "Install Mambaforge"
102-
MAMBA_URL="https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-Linux-aarch64.sh"
103-
echo "Downloading $MAMBA_URL"
104-
wget -q $MAMBA_URL -O minimamba.sh
105-
chmod +x minimamba.sh
106-
107-
MAMBA_DIR="$HOME/miniconda3"
108-
rm -rf $MAMBA_DIR
109-
./minimamba.sh -b -p $MAMBA_DIR
110-
111-
export PATH=$MAMBA_DIR/bin:$PATH
112-
113-
mamba install -y -c conda-forge anaconda-client
114-
104+
MINI_URL="https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Miniforge3-24.3.0-0-Linux-aarch64.sh"
105+
wget -q $MINI_URL -O Miniforge3.sh
106+
chmod +x Miniforge3.sh
107+
MINI_DIR="$HOME/miniconda3"
108+
rm -rf $MINI_DIR
109+
./Miniforge3.sh -b -p $MINI_DIR
110+
export PATH=$MINI_DIR/bin:$PATH
111+
conda install -y -c conda-forge anaconda-client
115112
source ci/upload_wheels.sh
116113
set_upload_vars
117114
upload_wheels

.github/workflows/code-checks.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ jobs:
5151
# TODO: The doctests have to be run first right now, since the Cython doctests only work
5252
# with pandas installed in non-editable mode
5353
# This can be removed once pytest-cython doesn't require C extensions to be installed inplace
54+
55+
- name: Extra installs
56+
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd
57+
run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0
58+
5459
- name: Run doctests
5560
run: cd ci && ./code_checks.sh doctests
5661
if: ${{ steps.build.outcome == 'success' && always() }}

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ jobs:
4646
- name: Build Pandas
4747
uses: ./.github/actions/build_pandas
4848

49+
- name: Extra installs
50+
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd
51+
run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0
52+
4953
- name: Test website
5054
run: python -m pytest web/
5155

.github/workflows/unit-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,8 @@ jobs:
134134
fetch-depth: 0
135135

136136
- name: Extra installs
137-
run: sudo apt-get update && sudo apt-get install -y ${{ matrix.extra_apt }}
138-
if: ${{ matrix.extra_apt }}
137+
# https://pytest-qt.readthedocs.io/en/latest/troubleshooting.html#github-actions-azure-pipelines-travis-ci-and-gitlab-ci-cd
138+
run: sudo apt-get update && sudo apt-get install -y libegl1 libopengl0 ${{ matrix.extra_apt || ''}}
139139

140140
- name: Generate extra locales
141141
# These extra locales will be available for locale.setlocale() calls in tests

ci/code_checks.sh

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7070
--format=actions \
7171
-i ES01 `# For now it is ok if docstrings are missing the extended summary` \
7272
-i "pandas.Series.dt PR01" `# Accessors are implemented as classes, but we do not document the Parameters section` \
73-
-i "pandas.MultiIndex.get_level_values SA01" \
7473
-i "pandas.MultiIndex.get_loc_level PR07" \
7574
-i "pandas.MultiIndex.names SA01" \
7675
-i "pandas.MultiIndex.reorder_levels RT03,SA01" \
@@ -165,9 +164,7 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
165164
-i "pandas.Series.str.center RT03,SA01" \
166165
-i "pandas.Series.str.decode PR07,RT03,SA01" \
167166
-i "pandas.Series.str.encode PR07,RT03,SA01" \
168-
-i "pandas.Series.str.find RT03" \
169167
-i "pandas.Series.str.fullmatch RT03" \
170-
-i "pandas.Series.str.get RT03,SA01" \
171168
-i "pandas.Series.str.index RT03" \
172169
-i "pandas.Series.str.ljust RT03,SA01" \
173170
-i "pandas.Series.str.lower RT03" \
@@ -177,7 +174,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
177174
-i "pandas.Series.str.partition RT03" \
178175
-i "pandas.Series.str.repeat SA01" \
179176
-i "pandas.Series.str.replace SA01" \
180-
-i "pandas.Series.str.rfind RT03" \
181177
-i "pandas.Series.str.rindex RT03" \
182178
-i "pandas.Series.str.rjust RT03,SA01" \
183179
-i "pandas.Series.str.rpartition RT03" \
@@ -268,7 +264,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
268264
-i "pandas.api.extensions.ExtensionArray.unique RT03,SA01" \
269265
-i "pandas.api.extensions.ExtensionArray.view SA01" \
270266
-i "pandas.api.interchange.from_dataframe RT03,SA01" \
271-
-i "pandas.api.types.is_any_real_numeric_dtype SA01" \
272267
-i "pandas.api.types.is_bool PR01,SA01" \
273268
-i "pandas.api.types.is_bool_dtype SA01" \
274269
-i "pandas.api.types.is_categorical_dtype SA01" \
@@ -295,7 +290,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
295290
-i "pandas.api.types.is_period_dtype SA01" \
296291
-i "pandas.api.types.is_re PR07,SA01" \
297292
-i "pandas.api.types.is_re_compilable PR07,SA01" \
298-
-i "pandas.api.types.is_sparse SA01" \
299293
-i "pandas.api.types.is_timedelta64_ns_dtype SA01" \
300294
-i "pandas.api.types.pandas_dtype PR07,RT03,SA01" \
301295
-i "pandas.arrays.ArrowExtensionArray PR07,SA01" \

doc/source/user_guide/basics.rst

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,6 @@ speedups. ``numexpr`` uses smart chunking, caching, and multiple cores. ``bottle
155155
a set of specialized cython routines that are especially fast when dealing with arrays that have
156156
``nans``.
157157

158-
Here is a sample (using 100 column x 100,000 row ``DataFrames``):
159-
160-
.. csv-table::
161-
:header: "Operation", "0.11.0 (ms)", "Prior Version (ms)", "Ratio to Prior"
162-
:widths: 25, 25, 25, 25
163-
164-
``df1 > df2``, 13.32, 125.35, 0.1063
165-
``df1 * df2``, 21.71, 36.63, 0.5928
166-
``df1 + df2``, 22.04, 36.50, 0.6039
167-
168158
You are highly encouraged to install both libraries. See the section
169159
:ref:`Recommended Dependencies <install.recommended_dependencies>` for more installation info.
170160

doc/source/whatsnew/v3.0.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ I/O
589589

590590
Period
591591
^^^^^^
592-
-
592+
- Fixed error message when passing invalid period alias to :meth:`PeriodIndex.to_timestamp` (:issue:`58974`)
593593
-
594594

595595
Plotting

pandas/_libs/tslibs/offsets.pyx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4752,20 +4752,16 @@ def _validate_to_offset_alias(alias: str, is_period: bool) -> None:
47524752
alias.lower() not in {"s", "ms", "us", "ns"} and
47534753
alias.upper().split("-")[0].endswith(("S", "E"))):
47544754
raise ValueError(INVALID_FREQ_ERR_MSG.format(alias))
4755-
if (is_period and
4756-
alias.upper() in c_OFFSET_TO_PERIOD_FREQSTR and
4757-
alias != "ms" and
4758-
alias.upper().split("-")[0].endswith(("S", "E"))):
4759-
if (alias.upper().startswith("B") or
4760-
alias.upper().startswith("S") or
4761-
alias.upper().startswith("C")):
4762-
raise ValueError(INVALID_FREQ_ERR_MSG.format(alias))
4763-
else:
4764-
alias_msg = "".join(alias.upper().split("E", 1))
4765-
raise ValueError(
4766-
f"for Period, please use \'{alias_msg}\' "
4767-
f"instead of \'{alias}\'"
4768-
)
4755+
if (
4756+
is_period and
4757+
alias in c_OFFSET_TO_PERIOD_FREQSTR and
4758+
alias != c_OFFSET_TO_PERIOD_FREQSTR[alias]
4759+
):
4760+
alias_msg = c_OFFSET_TO_PERIOD_FREQSTR.get(alias)
4761+
raise ValueError(
4762+
f"for Period, please use \'{alias_msg}\' "
4763+
f"instead of \'{alias}\'"
4764+
)
47694765

47704766

47714767
# TODO: better name?

pandas/conftest.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,6 @@ def nullable_string_dtype(request):
12961296
params=[
12971297
"python",
12981298
pytest.param("pyarrow", marks=td.skip_if_no("pyarrow")),
1299-
pytest.param("pyarrow_numpy", marks=td.skip_if_no("pyarrow")),
13001299
]
13011300
)
13021301
def string_storage(request):
@@ -1305,7 +1304,24 @@ def string_storage(request):
13051304
13061305
* 'python'
13071306
* 'pyarrow'
1308-
* 'pyarrow_numpy'
1307+
"""
1308+
return request.param
1309+
1310+
1311+
@pytest.fixture(
1312+
params=[
1313+
("python", pd.NA),
1314+
pytest.param(("pyarrow", pd.NA), marks=td.skip_if_no("pyarrow")),
1315+
pytest.param(("pyarrow", np.nan), marks=td.skip_if_no("pyarrow")),
1316+
]
1317+
)
1318+
def string_dtype_arguments(request):
1319+
"""
1320+
Parametrized fixture for StringDtype storage and na_value.
1321+
1322+
* 'python' + pd.NA
1323+
* 'pyarrow' + pd.NA
1324+
* 'pyarrow' + np.nan
13091325
"""
13101326
return request.param
13111327

pandas/core/config_init.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from collections.abc import Callable
1616
import os
17+
from typing import Any
1718

1819
import pandas._config.config as cf
1920
from pandas._config.config import (
@@ -455,12 +456,27 @@ def is_terminal() -> bool:
455456
``future.infer_string`` is set to True.
456457
"""
457458

459+
460+
def is_valid_string_storage(value: Any) -> None:
461+
legal_values = ["python", "pyarrow"]
462+
if value not in legal_values:
463+
msg = "Value must be one of python|pyarrow"
464+
if value == "pyarrow_numpy":
465+
# TODO: we can remove extra message after 3.0
466+
msg += (
467+
". 'pyarrow_numpy' was specified, but this option should be "
468+
"enabled using pandas.options.future.infer_string instead"
469+
)
470+
raise ValueError(msg)
471+
472+
458473
with cf.config_prefix("mode"):
459474
cf.register_option(
460475
"string_storage",
461476
"python",
462477
string_storage_doc,
463-
validator=is_one_of_factory(["python", "pyarrow", "pyarrow_numpy"]),
478+
# validator=is_one_of_factory(["python", "pyarrow"]),
479+
validator=is_valid_string_storage,
464480
)
465481

466482

0 commit comments

Comments
 (0)