Skip to content

Commit

Permalink
Merge branch 'change-closed-docs' of github.com:SebastianOuslis/panda…
Browse files Browse the repository at this point in the history
…s into change-closed-docs
  • Loading branch information
SebastianOuslis committed Feb 4, 2025
2 parents a89e745 + 41bf4be commit 30cf4c1
Show file tree
Hide file tree
Showing 95 changed files with 227 additions and 352 deletions.
32 changes: 13 additions & 19 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:

services:
mysql:
image: mysql:8
image: mysql:9
env:
MYSQL_ALLOW_EMPTY_PASSWORD: yes
MYSQL_DATABASE: pandas
Expand All @@ -120,7 +120,7 @@ jobs:
- 3306:3306

postgres:
image: postgres:16
image: postgres:17
env:
PGUSER: postgres
POSTGRES_USER: postgres
Expand All @@ -135,7 +135,7 @@ jobs:
- 5432:5432

moto:
image: motoserver/moto:5.0.0
image: motoserver/moto:5.0.27
env:
AWS_ACCESS_KEY_ID: foobar_key
AWS_SECRET_ACCESS_KEY: foobar_secret
Expand Down Expand Up @@ -242,15 +242,14 @@ jobs:
- name: Build environment and Run Tests
# https://github.com/numpy/numpy/issues/24703#issuecomment-1722379388
run: |
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
/opt/python/cp313-cp313/bin/python -m venv ~/virtualenvs/pandas-dev
. ~/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 -Csetup-args="-Dallow-noblas=true"
python -m pip install --no-cache-dir versioneer[toml] cython python-dateutil pytest>=7.3.2 pytest-xdist>=3.4.0 hypothesis>=6.84.0
python -m pip install --no-cache-dir --no-build-isolation -e . -Csetup-args="--werror"
python -m pip list --no-cache-dir
export PANDAS_CI=1
python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
PANDAS_CI=1 python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-32bit
Expand All @@ -259,7 +258,7 @@ jobs:
Linux-Musl:
runs-on: ubuntu-22.04
container:
image: quay.io/pypa/musllinux_1_1_x86_64
image: quay.io/pypa/musllinux_1_2_x86_64
steps:
- name: Checkout pandas Repo
# actions/checkout does not work since it requires node
Expand All @@ -281,7 +280,7 @@ jobs:
apk add musl-locales
- name: Build environment
run: |
/opt/python/cp311-cp311/bin/python -m venv ~/virtualenvs/pandas-dev
/opt/python/cp313-cp313/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 pytest>=7.3.2 pytest-xdist>=3.4.0 hypothesis>=6.84.0
Expand All @@ -291,8 +290,7 @@ jobs:
- name: Run Tests
run: |
. ~/virtualenvs/pandas-dev/bin/activate
export PANDAS_CI=1
python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
PANDAS_CI=1 python -m pytest -m 'not slow and not network and not clipboard and not single_cpu' pandas --junitxml=test-data.xml
concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-musl
Expand Down Expand Up @@ -357,8 +355,7 @@ jobs:
python --version
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 tzdata cython hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov
python -m pip install versioneer[toml] python-dateutil tzdata cython hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov
python -m pip install -ve . --no-build-isolation --no-index --no-deps -Csetup-args="--werror"
python -m pip list
Expand All @@ -375,7 +372,7 @@ jobs:

concurrency:
# https://github.community/t/concurrecy-not-work-for-push/183068/7
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.os }}-python-freethreading-dev
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-python-freethreading-dev
cancel-in-progress: true

env:
Expand All @@ -396,14 +393,11 @@ jobs:
nogil: true

- name: Build Environment
# TODO: Once numpy 2.2.1 is out, don't install nightly version
# Tests segfault with numpy 2.2.0: https://github.com/numpy/numpy/pull/27955
run: |
python --version
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 cython numpy
python -m pip install versioneer[toml]
python -m pip install python-dateutil pytz tzdata hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov
python -m pip install --upgrade pip setuptools wheel numpy 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 cython
python -m pip install versioneer[toml] python-dateutil pytz tzdata hypothesis>=6.84.0 pytest>=7.3.2 pytest-xdist>=3.4.0 pytest-cov
python -m pip install -ve . --no-build-isolation --no-index --no-deps -Csetup-args="--werror"
python -m pip list
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ci:
skip: [pyright, mypy]
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.6
rev: v0.9.4
hooks:
- id: ruff
args: [--exit-non-zero-on-fix]
Expand All @@ -41,7 +41,7 @@ repos:
pass_filenames: true
require_serial: false
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.1
hooks:
- id: codespell
types_or: [python, rst, markdown, cython, c]
Expand Down Expand Up @@ -70,7 +70,7 @@ repos:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
rev: 6.0.0
hooks:
- id: isort
- repo: https://github.com/asottile/pyupgrade
Expand All @@ -95,14 +95,14 @@ repos:
- id: sphinx-lint
args: ["--enable", "all", "--disable", "line-too-long"]
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v19.1.6
rev: v19.1.7
hooks:
- id: clang-format
files: ^pandas/_libs/src|^pandas/_libs/include
args: [-i]
types_or: [c, c++]
- repo: https://github.com/trim21/pre-commit-mirror-meson
rev: v1.6.1
rev: v1.7.0
hooks:
- id: meson-fmt
args: ['--inplace']
Expand Down
4 changes: 2 additions & 2 deletions asv_bench/benchmarks/io/style.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Render:
def setup(self, cols, rows):
self.df = DataFrame(
np.random.randn(rows, cols),
columns=[f"float_{i+1}" for i in range(cols)],
index=[f"row_{i+1}" for i in range(rows)],
columns=[f"float_{i + 1}" for i in range(cols)],
index=[f"row_{i + 1}" for i in range(rows)],
)

def time_apply_render(self, cols, rows):
Expand Down
6 changes: 2 additions & 4 deletions doc/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,7 @@ def latex(self, force=False):
for i in range(3):
self._run_os("pdflatex", "-interaction=nonstopmode", "pandas.tex")
raise SystemExit(
"You should check the file "
'"build/latex/pandas.pdf" for problems.'
'You should check the file "build/latex/pandas.pdf" for problems.'
)
self._run_os("make")
return ret_code
Expand Down Expand Up @@ -343,8 +342,7 @@ def main():
dest="verbosity",
default=0,
help=(
"increase verbosity (can be repeated), "
"passed to the sphinx build command"
"increase verbosity (can be repeated), passed to the sphinx build command"
),
)
argparser.add_argument(
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/style.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,7 @@
"outputs": [],
"source": [
"df2.loc[:4].style.highlight_max(\n",
" axis=1, props=(\"color:white; \" \"font-weight:bold; \" \"background-color:darkblue;\")\n",
" axis=1, props=(\"color:white; font-weight:bold; background-color:darkblue;\")\n",
")"
]
},
Expand Down
5 changes: 5 additions & 0 deletions pandas/_config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ def reset_option(pat: str) -> None:
"""
Reset one or more options to their default value.
This method resets the specified pandas option(s) back to their default
values. It allows partial string matching for convenience, but users should
exercise caution to avoid unintended resets due to changes in option names
in future versions.
Parameters
----------
pat : str/regex
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -1645,8 +1645,7 @@ def reconstruct_func(
# GH 28426 will raise error if duplicated function names are used and
# there is no reassigned name
raise SpecificationError(
"Function names must be unique if there is no new column names "
"assigned"
"Function names must be unique if there is no new column names assigned"
)
if func is None:
# nicer error message
Expand Down
6 changes: 4 additions & 2 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,9 +1791,11 @@ def take(self, indices, allow_fill=False, fill_value=None):
# type for the array, to the physical storage type for
# the data, before passing to take.
result = take(data, indices, fill_value=fill_value, allow_fill=allow_fill)
result = take(
data, indices, fill_value=fill_value, allow_fill=allow_fill
)
return self._from_sequence(result, dtype=self.dtype)
""" # noqa: E501
"""
# Implementer note: The `fill_value` parameter should be a user-facing
# value, an instance of self.dtype.type. When passed `fill_value=None`,
# the default of `self.dtype.na_value` should be used.
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2707,8 +2707,7 @@ def _maybe_infer_tz(tz: tzinfo | None, inferred_tz: tzinfo | None) -> tzinfo | N
pass
elif not timezones.tz_compare(tz, inferred_tz):
raise TypeError(
f"data is already tz-aware {inferred_tz}, unable to "
f"set specified tz: {tz}"
f"data is already tz-aware {inferred_tz}, unable to set specified tz: {tz}"
)
return tz

Expand Down
5 changes: 5 additions & 0 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,11 @@ def array(self) -> ExtensionArray:
"""
The ExtensionArray of the data backing this Series or Index.
This property provides direct access to the underlying array data of a
Series or Index without requiring conversion to a NumPy array. It
returns an ExtensionArray, which is the native storage format for
pandas extension dtypes.
Returns
-------
ExtensionArray
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/computation/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def eval(
By default, with the numexpr engine, the following operations are supported:
- Arthimetic operations: ``+``, ``-``, ``*``, ``/``, ``**``, ``%``
- Arithmetic operations: ``+``, ``-``, ``*``, ``/``, ``**``, ``%``
- Boolean operations: ``|`` (or), ``&`` (and), and ``~`` (not)
- Comparison operators: ``<``, ``<=``, ``==``, ``!=``, ``>=``, ``>``
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/computation/expr.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def visit_Call(self, node, side=None, **kwargs):
if not isinstance(key, ast.keyword):
# error: "expr" has no attribute "id"
raise ValueError(
"keyword error in function call " f"'{node.func.id}'" # type: ignore[attr-defined]
f"keyword error in function call '{node.func.id}'" # type: ignore[attr-defined]
)

if key.arg:
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/computation/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,8 +512,7 @@ def __init__(self, op: Literal["+", "-", "~", "not"], operand) -> None:
self.func = _unary_ops_dict[op]
except KeyError as err:
raise ValueError(
f"Invalid unary operator {op!r}, "
f"valid operators are {UNARY_OPS_SYMS}"
f"Invalid unary operator {op!r}, valid operators are {UNARY_OPS_SYMS}"
) from err

def __call__(self, env) -> MathCall:
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,7 @@ def maybe_cast_to_integer_array(arr: list | np.ndarray, dtype: np.dtype) -> np.n
# (test_constructor_coercion_signed_to_unsigned) so safe to ignore.
warnings.filterwarnings(
"ignore",
"NumPy will stop allowing conversion of " "out-of-bound Python int",
"NumPy will stop allowing conversion of out-of-bound Python int",
DeprecationWarning,
)
casted = np.asarray(arr, dtype=dtype)
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,8 +605,7 @@ def update_dtype(self, dtype: str_type | CategoricalDtype) -> CategoricalDtype:
return self
elif not self.is_dtype(dtype):
raise ValueError(
f"a CategoricalDtype must be passed to perform an update, "
f"got {dtype!r}"
f"a CategoricalDtype must be passed to perform an update, got {dtype!r}"
)
else:
# from here on, dtype is a CategoricalDtype
Expand Down
4 changes: 4 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13673,6 +13673,10 @@ def isin_(x):
doc="""
The column labels of the DataFrame.
This property holds the column names as a pandas ``Index`` object.
It provides an immutable sequence of column labels that can be
used for data selection, renaming, and alignment in DataFrame operations.
Returns
-------
pandas.Index
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -5537,8 +5537,7 @@ def filter(
nkw = common.count_not_none(items, like, regex)
if nkw > 1:
raise TypeError(
"Keyword arguments `items`, `like`, or `regex` "
"are mutually exclusive"
"Keyword arguments `items`, `like`, or `regex` are mutually exclusive"
)

if axis is None:
Expand Down
Loading

0 comments on commit 30cf4c1

Please sign in to comment.