Skip to content

Commit 5a74464

Browse files
Merge remote-tracking branch 'upstream/main' into bisect
2 parents d31a4c6 + 6edb64c commit 5a74464

Some content is hidden

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

73 files changed

+1129
-466
lines changed

.github/actions/build_pandas/action.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ runs:
1414
run: |
1515
git checkout main
1616
git status
17-
python setup.py build_ext -j 2
17+
python setup.py build_ext -j $N_JOBS
1818
python -m pip install -e . --no-build-isolation --no-use-pep517 --no-index
1919
conda list pandas
2020
shell: bash -el {0}
21+
env:
22+
# Cannot use parallel compilation on Windows, see https://github.com/pandas-dev/pandas/issues/30873
23+
N_JOBS: ${{ runner.os == 'Windows' && 1 || 2 }}

.github/workflows/code-checks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474

7575
- name: Install pyright
7676
# note: keep version in sync with .pre-commit-config.yaml
77-
run: npm install -g [email protected].230
77+
run: npm install -g [email protected].245
7878

7979
- name: Build Pandas
8080
id: build

.github/workflows/posix.yml

-1
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ jobs:
180180
run: ci/run_tests.sh
181181
# TODO: Don't continue on error for PyPy
182182
continue-on-error: ${{ env.IS_PYPY == 'true' }}
183-
if: always()
184183

185184
- name: Build Version
186185
run: conda list

.github/workflows/windows.yml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Windows
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 1.4.x
8+
pull_request:
9+
branches:
10+
- main
11+
- 1.4.x
12+
paths-ignore:
13+
- "doc/**"
14+
15+
env:
16+
PANDAS_CI: 1
17+
PYTEST_TARGET: pandas
18+
PYTEST_WORKERS: auto
19+
PATTERN: "not slow and not db and not network and not single_cpu"
20+
21+
22+
jobs:
23+
pytest:
24+
runs-on: windows-latest
25+
defaults:
26+
run:
27+
shell: bash -el {0}
28+
timeout-minutes: 90
29+
strategy:
30+
matrix:
31+
env_file: [actions-38.yaml, actions-39.yaml, actions-310.yaml]
32+
fail-fast: false
33+
concurrency:
34+
# https://github.community/t/concurrecy-not-work-for-push/183068/7
35+
group: ${{ github.event_name == 'push' && github.run_number || github.ref }}-${{ matrix.env_file }}-windows
36+
cancel-in-progress: true
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v3
41+
with:
42+
fetch-depth: 0
43+
44+
- name: Install Dependencies
45+
uses: conda-incubator/[email protected]
46+
with:
47+
mamba-version: "*"
48+
channels: conda-forge
49+
activate-environment: pandas-dev
50+
channel-priority: strict
51+
environment-file: ci/deps/${{ matrix.env_file }}
52+
use-only-tar-bz2: true
53+
54+
- name: Build Pandas
55+
uses: ./.github/actions/build_pandas
56+
57+
- name: Test
58+
run: ci/run_tests.sh
59+
60+
- name: Build Version
61+
run: conda list
62+
63+
- name: Publish test results
64+
uses: actions/upload-artifact@v3
65+
with:
66+
name: Test results
67+
path: test-data.xml
68+
if: failure()
69+
70+
- name: Upload coverage to Codecov
71+
uses: codecov/codecov-action@v2
72+
with:
73+
flags: unittests
74+
name: codecov-pandas
75+
fail_ci_if_error: false

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ repos:
8989
types: [python]
9090
stages: [manual]
9191
# note: keep version in sync with .github/workflows/code-checks.yml
92-
additional_dependencies: ['[email protected].230']
92+
additional_dependencies: ['[email protected].245']
9393
- repo: local
9494
hooks:
9595
- id: flake8-rst

azure-pipelines.yml

-5
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,6 @@ jobs:
2727
name: macOS
2828
vmImage: macOS-10.15
2929

30-
- template: ci/azure/windows.yml
31-
parameters:
32-
name: Windows
33-
vmImage: windows-2019
34-
3530
- job: py38_32bit
3631
pool:
3732
vmImage: ubuntu-18.04

ci/azure/windows.yml

-58
This file was deleted.

doc/source/getting_started/intro_tutorials/includes/titanic.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ consists of the following data columns:
2626
.. raw:: html
2727

2828
</p>
29-
<a href="https://github.com/pandas-dev/pandas/tree/main/doc/data/titanic.csv" class="btn btn-dark btn-sm">To raw data</a>
29+
<a href="https://github.com/pandas-dev/pandas/raw/main/doc/data/titanic.csv" class="btn btn-dark btn-sm">To raw data</a>
3030
</div>
3131
</div>

doc/source/user_guide/cookbook.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ Unlike agg, apply's callable is passed a sub-DataFrame which gives you access to
511511
512512
def replace(g):
513513
mask = g < 0
514-
return g.where(mask, g[~mask].mean())
514+
return g.where(~mask, g[~mask].mean())
515515
516516
gb.transform(replace)
517517

doc/source/whatsnew/v1.5.0.rst

+27
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,31 @@ as seen in the following example.
100100
1 2021-01-02 08:00:00 4
101101
2 2021-01-02 16:00:00 5
102102
103+
.. _whatsnew_150.enhancements.tar:
104+
105+
Reading directly from TAR archives
106+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
107+
108+
I/O methods like :func:`read_csv` or :meth:`DataFrame.to_json` now allow reading and writing
109+
directly on TAR archives (:issue:`44787`).
110+
111+
.. code-block:: python
112+
113+
df = pd.read_csv("./movement.tar.gz")
114+
# ...
115+
df.to_csv("./out.tar.gz")
116+
117+
This supports ``.tar``, ``.tar.gz``, ``.tar.bz`` and ``.tar.xz2`` archives.
118+
The used compression method is inferred from the filename.
119+
If the compression method cannot be inferred, use the ``compression`` argument:
120+
121+
.. code-block:: python
122+
123+
df = pd.read_csv(some_file_obj, compression={"method": "tar", "mode": "r:gz"}) # noqa F821
124+
125+
(``mode`` being one of ``tarfile.open``'s modes: https://docs.python.org/3/library/tarfile.html#tarfile.open)
126+
127+
103128
.. _whatsnew_150.enhancements.other:
104129

105130
Other enhancements
@@ -527,6 +552,7 @@ Other Deprecations
527552
- Deprecated passing arguments as positional in :meth:`DataFrame.any` and :meth:`Series.any` (:issue:`44802`)
528553
- Deprecated the ``closed`` argument in :meth:`interval_range` in favor of ``inclusive`` argument; In a future version passing ``closed`` will raise (:issue:`40245`)
529554
- Deprecated the methods :meth:`DataFrame.mad`, :meth:`Series.mad`, and the corresponding groupby methods (:issue:`11787`)
555+
- Deprecated positional arguments to :meth:`Index.join` except for ``other``, use keyword-only arguments instead of positional arguments (:issue:`46518`)
530556

531557
.. ---------------------------------------------------------------------------
532558
.. _whatsnew_150.performance:
@@ -708,6 +734,7 @@ Groupby/resample/rolling
708734
- Bug in :meth:`Rolling.var` and :meth:`Rolling.std` would give non-zero result with window of same values (:issue:`42064`)
709735
- Bug in :meth:`.Rolling.var` would segfault calculating weighted variance when window size was larger than data size (:issue:`46760`)
710736
- Bug in :meth:`Grouper.__repr__` where ``dropna`` was not included. Now it is (:issue:`46754`)
737+
- Bug in :meth:`DataFrame.rolling` gives ValueError when center=True, axis=1 and win_type is specified (:issue:`46135`)
711738

712739
Reshaping
713740
^^^^^^^^^

pandas/__init__.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,33 @@
33
__docformat__ = "restructuredtext"
44

55
# Let users know if they're missing any of our hard dependencies
6-
hard_dependencies = ("numpy", "pytz", "dateutil")
7-
missing_dependencies = []
6+
_hard_dependencies = ("numpy", "pytz", "dateutil")
7+
_missing_dependencies = []
88

9-
for dependency in hard_dependencies:
9+
for _dependency in _hard_dependencies:
1010
try:
11-
__import__(dependency)
12-
except ImportError as e:
13-
missing_dependencies.append(f"{dependency}: {e}")
11+
__import__(_dependency)
12+
except ImportError as _e:
13+
_missing_dependencies.append(f"{_dependency}: {_e}")
1414

15-
if missing_dependencies:
15+
if _missing_dependencies:
1616
raise ImportError(
17-
"Unable to import required dependencies:\n" + "\n".join(missing_dependencies)
17+
"Unable to import required dependencies:\n" + "\n".join(_missing_dependencies)
1818
)
19-
del hard_dependencies, dependency, missing_dependencies
19+
del _hard_dependencies, _dependency, _missing_dependencies
2020

2121
# numpy compat
2222
from pandas.compat import is_numpy_dev as _is_numpy_dev
2323

2424
try:
2525
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
26-
except ImportError as err: # pragma: no cover
27-
module = err.name
26+
except ImportError as _err: # pragma: no cover
27+
_module = _err.name
2828
raise ImportError(
29-
f"C extension: {module} not built. If you want to import "
29+
f"C extension: {_module} not built. If you want to import "
3030
"pandas from the source directory, you may need to run "
3131
"'python setup.py build_ext --force' to build the C extensions first."
32-
) from err
32+
) from _err
3333
else:
3434
del _tslib, _lib, _hashtable
3535

pandas/_libs/groupby.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1325,8 +1325,8 @@ def group_rank(
13251325
mask=sub_mask,
13261326
)
13271327
for i in range(len(result)):
1328-
# TODO: why can't we do out[:, k] = result?
1329-
out[i, k] = result[i]
1328+
if labels[i] >= 0:
1329+
out[i, k] = result[i]
13301330

13311331

13321332
# ----------------------------------------------------------------------

0 commit comments

Comments
 (0)