Skip to content

Commit e1fa0a6

Browse files
authored
Merge branch 'main' into stata-no-memory-v2
2 parents 233a5e3 + a7da45d commit e1fa0a6

File tree

199 files changed

+1122
-2530
lines changed

Some content is hidden

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

199 files changed

+1122
-2530
lines changed

.github/workflows/code-checks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ jobs:
8686
echo "PYTHONPATH=$PYTHONPATH" >> $GITHUB_ENV
8787
if: ${{ steps.build.outcome == 'success' && always() }}
8888

89-
- name: Typing
89+
- name: Typing + pylint
9090
uses: pre-commit/[email protected]
9191
with:
9292
extra_args: --hook-stage manual --all-files

.github/workflows/wheels.yml

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,22 @@ jobs:
7272
env:
7373
CIBW_BUILD: ${{ matrix.python[0] }}-${{ matrix.buildplat[1] }}
7474

75-
# Used to test the built wheels
76-
- uses: actions/setup-python@v4
75+
# Used to test(Windows-only) and push the built wheels
76+
# You might need to use setup-python separately
77+
# if the new Python-dev version
78+
# is unavailable on conda-forge.
79+
- uses: conda-incubator/setup-miniconda@v2
7780
with:
81+
auto-update-conda: true
7882
python-version: ${{ matrix.python[1] }}
83+
activate-environment: test
84+
channels: conda-forge, anaconda
85+
channel-priority: true
86+
mamba-version: "*"
7987

8088
- name: Test wheels (Windows 64-bit only)
8189
if: ${{ matrix.buildplat[1] == 'win_amd64' }}
82-
shell: cmd
90+
shell: cmd /C CALL {0}
8391
run: |
8492
python ci/test_wheels.py wheelhouse
8593
@@ -88,26 +96,15 @@ jobs:
8896
name: ${{ matrix.python[0] }}-${{ startsWith(matrix.buildplat[1], 'macosx') && 'macosx' || matrix.buildplat[1] }}
8997
path: ./wheelhouse/*.whl
9098

91-
# Used to push the built wheels
92-
# TODO: once Python 3.11 is available on conda, de-dup with
93-
# setup python above
94-
- uses: conda-incubator/setup-miniconda@v2
95-
with:
96-
auto-update-conda: true
97-
# Really doesn't matter what version we upload with
98-
# just the version we test with
99-
python-version: '3.8'
100-
channels: conda-forge
101-
channel-priority: true
102-
mamba-version: "*"
10399

104100
- name: Install anaconda client
105101
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
102+
shell: bash -el {0}
106103
run: conda install -q -y anaconda-client
107104

108105

109106
- name: Upload wheels
110-
if: success()
107+
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
111108
shell: bash -el {0}
112109
env:
113110
PANDAS_STAGING_UPLOAD_TOKEN: ${{ secrets.PANDAS_STAGING_UPLOAD_TOKEN }}
@@ -180,11 +177,12 @@ jobs:
180177

181178
- name: Install anaconda client
182179
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
180+
shell: bash -el {0}
183181
run: |
184182
conda install -q -y anaconda-client
185183
186184
- name: Upload sdist
187-
if: success()
185+
if: ${{ success() && (env.IS_SCHEDULE_DISPATCH == 'true' || env.IS_PUSH == 'true') }}
188186
shell: bash -el {0}
189187
env:
190188
PANDAS_STAGING_UPLOAD_TOKEN: ${{ secrets.PANDAS_STAGING_UPLOAD_TOKEN }}

.pre-commit-config.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ repos:
1818
pass_filenames: true
1919
require_serial: false
2020
- repo: https://github.com/python/black
21-
rev: 22.8.0
21+
rev: 22.10.0
2222
hooks:
2323
- id: black
2424
- repo: https://github.com/codespell-project/codespell
25-
rev: v2.2.1
25+
rev: v2.2.2
2626
hooks:
2727
- id: codespell
2828
types_or: [python, rst, markdown]
2929
- repo: https://github.com/MarcoGorelli/cython-lint
30-
rev: v0.1.8
30+
rev: v0.2.1
3131
hooks:
3232
- id: cython-lint
3333
- repo: https://github.com/pre-commit/pre-commit-hooks
@@ -60,15 +60,16 @@ repos:
6060
- flake8-bugbear==22.7.1
6161
- pandas-dev-flaker==0.5.0
6262
- repo: https://github.com/pycqa/pylint
63-
rev: v2.15.3
63+
rev: v2.15.5
6464
hooks:
6565
- id: pylint
66+
stages: [manual]
6667
- repo: https://github.com/PyCQA/isort
6768
rev: 5.10.1
6869
hooks:
6970
- id: isort
7071
- repo: https://github.com/asottile/pyupgrade
71-
rev: v2.38.2
72+
rev: v3.2.0
7273
hooks:
7374
- id: pyupgrade
7475
args: [--py38-plus]
@@ -83,7 +84,7 @@ repos:
8384
types: [text] # overwrite types: [rst]
8485
types_or: [python, rst]
8586
- repo: https://github.com/sphinx-contrib/sphinx-lint
86-
rev: v0.6.1
87+
rev: v0.6.7
8788
hooks:
8889
- id: sphinx-lint
8990
- repo: https://github.com/asottile/yesqa

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,6 @@ You can also triage issues which may include reproducing bug reports, or asking
166166

167167
Or maybe through using pandas you have an idea of your own or are looking for something in the documentation and thinking ‘this can be improved’...you can do something about it!
168168

169-
Feel free to ask questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Gitter](https://gitter.im/pydata/pandas).
169+
Feel free to ask questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Slack](https://pandas.pydata.org/docs/dev/development/community.html?highlight=slack#community-slack).
170170

171171
As contributors and maintainers to this project, you are expected to abide by pandas' code of conduct. More information can be found at: [Contributor Code of Conduct](https://github.com/pandas-dev/.github/blob/master/CODE_OF_CONDUCT.md)

asv_bench/benchmarks/frame_methods.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,6 @@ def time_frame_get_numeric_data(self):
2828
self.df._get_numeric_data()
2929

3030

31-
class Lookup:
32-
def setup(self):
33-
self.df = DataFrame(np.random.randn(10000, 8), columns=list("abcdefgh"))
34-
self.df["foo"] = "bar"
35-
self.row_labels = list(self.df.index[::10])[:900]
36-
self.col_labels = list(self.df.columns) * 100
37-
self.row_labels_all = np.array(
38-
list(self.df.index) * len(self.df.columns), dtype="object"
39-
)
40-
self.col_labels_all = np.array(
41-
list(self.df.columns) * len(self.df.index), dtype="object"
42-
)
43-
44-
def time_frame_fancy_lookup(self):
45-
self.df.lookup(self.row_labels, self.col_labels)
46-
47-
def time_frame_fancy_lookup_all(self):
48-
self.df.lookup(self.row_labels_all, self.col_labels_all)
49-
50-
5131
class Reindex:
5232
def setup(self):
5333
N = 10**3

asv_bench/benchmarks/inference.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ class ToDatetimeFormat:
223223
def setup(self):
224224
N = 100000
225225
self.s = Series(["19MAY11", "19MAY11:00:00:00"] * N)
226-
self.s2 = self.s.str.replace(":\\S+$", "")
226+
self.s2 = self.s.str.replace(":\\S+$", "", regex=True)
227227

228228
self.same_offset = ["10/11/2018 00:00:00.045-07:00"] * N
229229
self.diff_offset = [

asv_bench/benchmarks/io/hdf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def setup(self):
4343
np.random.randn(N, 100), index=date_range("1/1/2000", periods=N)
4444
)
4545
self.df_dc = DataFrame(
46-
np.random.randn(N, 10), columns=["C%03d" % i for i in range(10)]
46+
np.random.randn(N, 10), columns=[f"C{i:03d}" for i in range(10)]
4747
)
4848

4949
self.fname = "__test__.h5"

asv_bench/benchmarks/join_merge.py

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,6 @@
2222
from pandas import ordered_merge as merge_ordered
2323

2424

25-
class Append:
26-
def setup(self):
27-
self.df1 = DataFrame(np.random.randn(10000, 4), columns=["A", "B", "C", "D"])
28-
self.df2 = self.df1.copy()
29-
self.df2.index = np.arange(10000, 20000)
30-
self.mdf1 = self.df1.copy()
31-
self.mdf1["obj1"] = "bar"
32-
self.mdf1["obj2"] = "bar"
33-
self.mdf1["int1"] = 5
34-
self.mdf1 = self.mdf1._consolidate()
35-
self.mdf2 = self.mdf1.copy()
36-
self.mdf2.index = self.df2.index
37-
38-
def time_append_homogenous(self):
39-
self.df1.append(self.df2)
40-
41-
def time_append_mixed(self):
42-
self.mdf1.append(self.mdf2)
43-
44-
4525
class Concat:
4626

4727
params = [0, 1]

asv_bench/benchmarks/tslibs/timestamp.py

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,62 +50,58 @@ def time_from_pd_timestamp(self):
5050

5151

5252
class TimestampProperties:
53-
_freqs = [None, "B"]
54-
params = [_tzs, _freqs]
55-
param_names = ["tz", "freq"]
53+
params = [_tzs]
54+
param_names = ["tz"]
5655

57-
def setup(self, tz, freq):
58-
self.ts = Timestamp("2017-08-25 08:16:14", tzinfo=tz, freq=freq)
56+
def setup(self, tz):
57+
self.ts = Timestamp("2017-08-25 08:16:14", tzinfo=tz)
5958

60-
def time_tz(self, tz, freq):
59+
def time_tz(self, tz):
6160
self.ts.tz
6261

63-
def time_dayofweek(self, tz, freq):
62+
def time_dayofweek(self, tz):
6463
self.ts.dayofweek
6564

66-
def time_dayofyear(self, tz, freq):
65+
def time_dayofyear(self, tz):
6766
self.ts.dayofyear
6867

69-
def time_week(self, tz, freq):
68+
def time_week(self, tz):
7069
self.ts.week
7170

72-
def time_quarter(self, tz, freq):
71+
def time_quarter(self, tz):
7372
self.ts.quarter
7473

75-
def time_days_in_month(self, tz, freq):
74+
def time_days_in_month(self, tz):
7675
self.ts.days_in_month
7776

78-
def time_freqstr(self, tz, freq):
79-
self.ts.freqstr
80-
81-
def time_is_month_start(self, tz, freq):
77+
def time_is_month_start(self, tz):
8278
self.ts.is_month_start
8379

84-
def time_is_month_end(self, tz, freq):
80+
def time_is_month_end(self, tz):
8581
self.ts.is_month_end
8682

87-
def time_is_quarter_start(self, tz, freq):
83+
def time_is_quarter_start(self, tz):
8884
self.ts.is_quarter_start
8985

90-
def time_is_quarter_end(self, tz, freq):
86+
def time_is_quarter_end(self, tz):
9187
self.ts.is_quarter_end
9288

93-
def time_is_year_start(self, tz, freq):
89+
def time_is_year_start(self, tz):
9490
self.ts.is_year_start
9591

96-
def time_is_year_end(self, tz, freq):
92+
def time_is_year_end(self, tz):
9793
self.ts.is_year_end
9894

99-
def time_is_leap_year(self, tz, freq):
95+
def time_is_leap_year(self, tz):
10096
self.ts.is_leap_year
10197

102-
def time_microsecond(self, tz, freq):
98+
def time_microsecond(self, tz):
10399
self.ts.microsecond
104100

105-
def time_month_name(self, tz, freq):
101+
def time_month_name(self, tz):
106102
self.ts.month_name()
107103

108-
def time_weekday_name(self, tz, freq):
104+
def time_weekday_name(self, tz):
109105
self.ts.day_name()
110106

111107

ci/fix_wheels.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
import zipfile
55

66
try:
7-
_, wheel_path, dest_dir = sys.argv
7+
if len(sys.argv) != 3:
8+
raise ValueError(
9+
"User must pass the path to the wheel and the destination directory."
10+
)
11+
wheel_path = sys.argv[1]
12+
dest_dir = sys.argv[2]
813
# Figure out whether we are building on 32 or 64 bit python
914
is_32 = sys.maxsize <= 2**32
1015
PYTHON_ARCH = "x86" if is_32 else "x64"
@@ -50,5 +55,4 @@
5055
if not success:
5156
os.remove(repaired_wheel_path)
5257
raise exception
53-
else:
54-
print(f"Successfully repaired wheel was written to {repaired_wheel_path}")
58+
print(f"Successfully repaired wheel was written to {repaired_wheel_path}")

ci/test_wheels.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import glob
22
import os
3-
import platform
43
import shutil
54
import subprocess
65
import sys
76

87
if os.name == "nt":
9-
py_ver = platform.python_version()
8+
py_ver = f"{sys.version_info.major}.{sys.version_info.minor}"
109
is_32_bit = os.getenv("IS_32_BIT") == "true"
1110
try:
1211
wheel_dir = sys.argv[1]

doc/make.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ def latex(self, force=False):
259259
"You should check the file "
260260
'"build/latex/pandas.pdf" for problems.'
261261
)
262-
else:
263-
self._run_os("make")
262+
self._run_os("make")
264263
return ret_code
265264

266265
def latex_forced(self):

doc/redirects.csv

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,6 @@ generated/pandas.DataFrame.aggregate,../reference/api/pandas.DataFrame.aggregate
315315
generated/pandas.DataFrame.align,../reference/api/pandas.DataFrame.align
316316
generated/pandas.DataFrame.all,../reference/api/pandas.DataFrame.all
317317
generated/pandas.DataFrame.any,../reference/api/pandas.DataFrame.any
318-
generated/pandas.DataFrame.append,../reference/api/pandas.DataFrame.append
319318
generated/pandas.DataFrame.apply,../reference/api/pandas.DataFrame.apply
320319
generated/pandas.DataFrame.applymap,../reference/api/pandas.DataFrame.applymap
321320
generated/pandas.DataFrame.as_blocks,../reference/api/pandas.DataFrame.as_blocks
@@ -408,7 +407,6 @@ generated/pandas.DataFrame.last,../reference/api/pandas.DataFrame.last
408407
generated/pandas.DataFrame.last_valid_index,../reference/api/pandas.DataFrame.last_valid_index
409408
generated/pandas.DataFrame.le,../reference/api/pandas.DataFrame.le
410409
generated/pandas.DataFrame.loc,../reference/api/pandas.DataFrame.loc
411-
generated/pandas.DataFrame.lookup,../reference/api/pandas.DataFrame.lookup
412410
generated/pandas.DataFrame.lt,../reference/api/pandas.DataFrame.lt
413411
generated/pandas.DataFrame.mask,../reference/api/pandas.DataFrame.mask
414412
generated/pandas.DataFrame.max,../reference/api/pandas.DataFrame.max
@@ -917,7 +915,6 @@ generated/pandas.Series.aggregate,../reference/api/pandas.Series.aggregate
917915
generated/pandas.Series.align,../reference/api/pandas.Series.align
918916
generated/pandas.Series.all,../reference/api/pandas.Series.all
919917
generated/pandas.Series.any,../reference/api/pandas.Series.any
920-
generated/pandas.Series.append,../reference/api/pandas.Series.append
921918
generated/pandas.Series.apply,../reference/api/pandas.Series.apply
922919
generated/pandas.Series.argmax,../reference/api/pandas.Series.argmax
923920
generated/pandas.Series.argmin,../reference/api/pandas.Series.argmin
@@ -1321,8 +1318,6 @@ generated/pandas.Timestamp.daysinmonth,../reference/api/pandas.Timestamp.daysinm
13211318
generated/pandas.Timestamp.dst,../reference/api/pandas.Timestamp.dst
13221319
generated/pandas.Timestamp.floor,../reference/api/pandas.Timestamp.floor
13231320
generated/pandas.Timestamp.fold,../reference/api/pandas.Timestamp.fold
1324-
generated/pandas.Timestamp.freq,../reference/api/pandas.Timestamp.freq
1325-
generated/pandas.Timestamp.freqstr,../reference/api/pandas.Timestamp.freqstr
13261321
generated/pandas.Timestamp.fromisoformat,../reference/api/pandas.Timestamp.fromisoformat
13271322
generated/pandas.Timestamp.fromordinal,../reference/api/pandas.Timestamp.fromordinal
13281323
generated/pandas.Timestamp.fromtimestamp,../reference/api/pandas.Timestamp.fromtimestamp

doc/scripts/eval_performance.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def bench_with(n, times=10, repeat=3, engine="numexpr"):
1717
return (
1818
np.array(
1919
timeit(
20-
"df.eval(s, engine=%r)" % engine,
20+
f"df.eval(s, engine={repr(engine)})",
2121
setup=setup_common % (n, setup_with),
2222
repeat=repeat,
2323
number=times,
@@ -34,7 +34,7 @@ def bench_subset(n, times=20, repeat=3, engine="numexpr"):
3434
return (
3535
np.array(
3636
timeit(
37-
"df.query(s, engine=%r)" % engine,
37+
f"df.query(s, engine={repr(engine)})",
3838
setup=setup_common % (n, setup_subset),
3939
repeat=repeat,
4040
number=times,
@@ -55,7 +55,7 @@ def bench(mn=3, mx=7, num=100, engines=("python", "numexpr"), verbose=False):
5555
for engine in engines:
5656
for i, n in enumerate(r):
5757
if verbose & (i % 10 == 0):
58-
print("engine: %r, i == %d" % (engine, i))
58+
print(f"engine: {repr(engine)}, i == {i:d}")
5959
ev_times = bench_with(n, times=1, repeat=1, engine=engine)
6060
ev.loc[i, engine] = np.mean(ev_times)
6161
qu_times = bench_subset(n, times=1, repeat=1, engine=engine)

0 commit comments

Comments
 (0)