Skip to content

Commit bb2875d

Browse files
committed
Merge branch 'main' into depr-setops
2 parents 86275d8 + d13c9e0 commit bb2875d

File tree

172 files changed

+889
-1312
lines changed

Some content is hidden

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

172 files changed

+889
-1312
lines changed

.pre-commit-config.yaml

+6-6
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,15 @@ 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
6666
- repo: https://github.com/PyCQA/isort
6767
rev: 5.10.1
6868
hooks:
6969
- id: isort
7070
- repo: https://github.com/asottile/pyupgrade
71-
rev: v2.38.2
71+
rev: v3.2.0
7272
hooks:
7373
- id: pyupgrade
7474
args: [--py38-plus]
@@ -83,7 +83,7 @@ repos:
8383
types: [text] # overwrite types: [rst]
8484
types_or: [python, rst]
8585
- repo: https://github.com/sphinx-contrib/sphinx-lint
86-
rev: v0.6.1
86+
rev: v0.6.7
8787
hooks:
8888
- id: sphinx-lint
8989
- repo: https://github.com/asottile/yesqa

asv_bench/benchmarks/inference.py

+1-1
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

+1-1
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/tslibs/timestamp.py

+20-24
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

+7-3
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}")

doc/make.py

+1-2
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

-2
Original file line numberDiff line numberDiff line change
@@ -1321,8 +1321,6 @@ generated/pandas.Timestamp.daysinmonth,../reference/api/pandas.Timestamp.daysinm
13211321
generated/pandas.Timestamp.dst,../reference/api/pandas.Timestamp.dst
13221322
generated/pandas.Timestamp.floor,../reference/api/pandas.Timestamp.floor
13231323
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
13261324
generated/pandas.Timestamp.fromisoformat,../reference/api/pandas.Timestamp.fromisoformat
13271325
generated/pandas.Timestamp.fromordinal,../reference/api/pandas.Timestamp.fromordinal
13281326
generated/pandas.Timestamp.fromtimestamp,../reference/api/pandas.Timestamp.fromtimestamp

doc/scripts/eval_performance.py

+3-3
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)

doc/source/getting_started/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ Dependency Minimum Version optional_extra Notes
417417
PyTables 3.6.1 hdf5 HDF5-based reading / writing
418418
blosc 1.21.0 hdf5 Compression for HDF5
419419
zlib hdf5 Compression for HDF5
420-
fastparquet 0.4.0 - Parquet reading / writing (pyarrow is default)
420+
fastparquet 0.6.3 - Parquet reading / writing (pyarrow is default)
421421
pyarrow 6.0.0 parquet, feather Parquet, ORC, and feather reading / writing
422422
pyreadstat 1.1.2 spss SPSS files (.sav) reading
423423
odfpy 1.4.1 excel Open document format (.odf, .ods, .odt) reading / writing

doc/source/reference/arrays.rst

-2
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,6 @@ Methods
157157
Timestamp.day_name
158158
Timestamp.dst
159159
Timestamp.floor
160-
Timestamp.freq
161-
Timestamp.freqstr
162160
Timestamp.fromordinal
163161
Timestamp.fromtimestamp
164162
Timestamp.isocalendar

doc/source/user_guide/timedeltas.rst

+9-8
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,7 @@ Numeric reduction operation for ``timedelta64[ns]`` will return ``Timedelta`` ob
236236
Frequency conversion
237237
--------------------
238238

239-
Timedelta Series, ``TimedeltaIndex``, and ``Timedelta`` scalars can be converted to other 'frequencies' by dividing by another timedelta,
240-
or by astyping to a specific timedelta type. These operations yield Series and propagate ``NaT`` -> ``nan``.
241-
Note that division by the NumPy scalar is true division, while astyping is equivalent of floor division.
239+
Timedelta Series and ``TimedeltaIndex``, and ``Timedelta`` can be converted to other frequencies by astyping to a specific timedelta dtype.
242240

243241
.. ipython:: python
244242
@@ -250,14 +248,17 @@ Note that division by the NumPy scalar is true division, while astyping is equiv
250248
td[3] = np.nan
251249
td
252250
253-
# to days
254-
td / np.timedelta64(1, "D")
255-
td.astype("timedelta64[D]")
256-
257251
# to seconds
258-
td / np.timedelta64(1, "s")
259252
td.astype("timedelta64[s]")
260253
254+
For timedelta64 resolutions other than the supported "s", "ms", "us", "ns",
255+
an alternative is to divide by another timedelta object. Note that division by the NumPy scalar is true division, while astyping is equivalent of floor division.
256+
257+
.. ipython:: python
258+
259+
# to days
260+
td / np.timedelta64(1, "D")
261+
261262
# to months (these are constant months)
262263
td / np.timedelta64(1, "M")
263264

doc/source/whatsnew/v0.13.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,7 @@ Enhancements
532532
is frequency conversion. See :ref:`the docs<timedeltas.timedeltas_convert>` for the docs.
533533

534534
.. ipython:: python
535+
:okexcept:
535536
536537
import datetime
537538
td = pd.Series(pd.date_range('20130101', periods=4)) - pd.Series(

doc/source/whatsnew/v0.24.0.rst

+1
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,7 @@ the object's ``freq`` attribute (:issue:`21939`, :issue:`23878`).
13571357
*New behavior*:
13581358

13591359
.. ipython:: python
1360+
:okexcept:
13601361
:okwarning:
13611362
13621363
ts = pd.Timestamp('1994-05-06 12:15:16', freq=pd.offsets.Hour())

0 commit comments

Comments
 (0)