Skip to content

Commit 9dbdace

Browse files
committed
Merge remote-tracking branch 'upstream/master' into krey-master
2 parents 4ebe98b + d569905 commit 9dbdace

File tree

409 files changed

+8477
-8999
lines changed

Some content is hidden

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

409 files changed

+8477
-8999
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ matrix:
3232
include:
3333
- dist: bionic
3434
# 18.04
35-
python: 3.8-dev
35+
python: 3.8.0
3636
env:
3737
- JOB="3.8-dev" PATTERN="(not slow and not network)"
3838

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div align="center">
2-
<img src="https://github.com/pandas-dev/pandas/blob/master/doc/logo/pandas_logo.png"><br>
2+
<img src="https://dev.pandas.io/static/img/pandas.svg"><br>
33
</div>
44

55
-----------------
@@ -190,7 +190,7 @@ or for installing in [development mode](https://pip.pypa.io/en/latest/reference/
190190

191191

192192
```sh
193-
python -m pip install --no-build-isolation -e .
193+
python -m pip install -e . --no-build-isolation --no-use-pep517
194194
```
195195

196196
If you have `make`, you can also use `make develop` to run the same command.

asv_bench/benchmarks/offset.py

-49
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
from datetime import datetime
21
import warnings
32

4-
import numpy as np
5-
63
import pandas as pd
74

85
try:
@@ -54,24 +51,6 @@ def time_apply_index(self, offset):
5451
offset.apply_index(self.rng)
5552

5653

57-
class OnOffset:
58-
59-
params = offsets
60-
param_names = ["offset"]
61-
62-
def setup(self, offset):
63-
self.dates = [
64-
datetime(2016, m, d)
65-
for m in [10, 11, 12]
66-
for d in [1, 2, 3, 28, 29, 30, 31]
67-
if not (m == 11 and d == 31)
68-
]
69-
70-
def time_on_offset(self, offset):
71-
for date in self.dates:
72-
offset.onOffset(date)
73-
74-
7554
class OffsetSeriesArithmetic:
7655

7756
params = offsets
@@ -99,31 +78,3 @@ def setup(self, offset):
9978
def time_add_offset(self, offset):
10079
with warnings.catch_warnings(record=True):
10180
self.data + offset
102-
103-
104-
class OffestDatetimeArithmetic:
105-
106-
params = offsets
107-
param_names = ["offset"]
108-
109-
def setup(self, offset):
110-
self.date = datetime(2011, 1, 1)
111-
self.dt64 = np.datetime64("2011-01-01 09:00Z")
112-
113-
def time_apply(self, offset):
114-
offset.apply(self.date)
115-
116-
def time_apply_np_dt64(self, offset):
117-
offset.apply(self.dt64)
118-
119-
def time_add(self, offset):
120-
self.date + offset
121-
122-
def time_add_10(self, offset):
123-
self.date + (10 * offset)
124-
125-
def time_subtract(self, offset):
126-
self.date - offset
127-
128-
def time_subtract_10(self, offset):
129-
self.date - (10 * offset)

asv_bench/benchmarks/period.py

+4-63
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,12 @@
1+
"""
2+
Period benchmarks with non-tslibs dependencies. See
3+
benchmarks.tslibs.period for benchmarks that rely only on tslibs.
4+
"""
15
from pandas import DataFrame, Period, PeriodIndex, Series, date_range, period_range
26

37
from pandas.tseries.frequencies import to_offset
48

59

6-
class PeriodProperties:
7-
8-
params = (
9-
["M", "min"],
10-
[
11-
"year",
12-
"month",
13-
"day",
14-
"hour",
15-
"minute",
16-
"second",
17-
"is_leap_year",
18-
"quarter",
19-
"qyear",
20-
"week",
21-
"daysinmonth",
22-
"dayofweek",
23-
"dayofyear",
24-
"start_time",
25-
"end_time",
26-
],
27-
)
28-
param_names = ["freq", "attr"]
29-
30-
def setup(self, freq, attr):
31-
self.per = Period("2012-06-01", freq=freq)
32-
33-
def time_property(self, freq, attr):
34-
getattr(self.per, attr)
35-
36-
37-
class PeriodUnaryMethods:
38-
39-
params = ["M", "min"]
40-
param_names = ["freq"]
41-
42-
def setup(self, freq):
43-
self.per = Period("2012-06-01", freq=freq)
44-
45-
def time_to_timestamp(self, freq):
46-
self.per.to_timestamp()
47-
48-
def time_now(self, freq):
49-
self.per.now(freq)
50-
51-
def time_asfreq(self, freq):
52-
self.per.asfreq("A")
53-
54-
55-
class PeriodConstructor:
56-
params = [["D"], [True, False]]
57-
param_names = ["freq", "is_offset"]
58-
59-
def setup(self, freq, is_offset):
60-
if is_offset:
61-
self.freq = to_offset(freq)
62-
else:
63-
self.freq = freq
64-
65-
def time_period_constructor(self, freq, is_offset):
66-
Period("2012-06-01", freq=freq)
67-
68-
6910
class PeriodIndexConstructor:
7011

7112
params = [["D"], [True, False]]

asv_bench/benchmarks/rolling.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ def peakmem_rolling(self, constructor, window, dtype, method):
2828
class Apply:
2929
params = (
3030
["DataFrame", "Series"],
31-
[10, 1000],
31+
[3, 300],
3232
["int", "float"],
3333
[sum, np.sum, lambda x: np.sum(x) + 5],
3434
[True, False],
3535
)
36-
param_names = ["contructor", "window", "dtype", "function", "raw"]
36+
param_names = ["constructor", "window", "dtype", "function", "raw"]
3737

3838
def setup(self, constructor, window, dtype, function, raw):
39-
N = 10 ** 5
39+
N = 10 ** 3
4040
arr = (100 * np.random.random(N)).astype(dtype)
4141
self.roll = getattr(pd, constructor)(arr).rolling(window)
4242

asv_bench/benchmarks/timedelta.py

+5-61
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,11 @@
1-
import datetime
1+
"""
2+
Timedelta benchmarks with non-tslibs dependencies. See
3+
benchmarks.tslibs.timedelta for benchmarks that rely only on tslibs.
4+
"""
25

36
import numpy as np
47

5-
from pandas import (
6-
DataFrame,
7-
Series,
8-
Timedelta,
9-
Timestamp,
10-
timedelta_range,
11-
to_timedelta,
12-
)
13-
14-
15-
class TimedeltaConstructor:
16-
def time_from_int(self):
17-
Timedelta(123456789)
18-
19-
def time_from_unit(self):
20-
Timedelta(1, unit="d")
21-
22-
def time_from_components(self):
23-
Timedelta(
24-
days=1,
25-
hours=2,
26-
minutes=3,
27-
seconds=4,
28-
milliseconds=5,
29-
microseconds=6,
30-
nanoseconds=7,
31-
)
32-
33-
def time_from_datetime_timedelta(self):
34-
Timedelta(datetime.timedelta(days=1, seconds=1))
35-
36-
def time_from_np_timedelta(self):
37-
Timedelta(np.timedelta64(1, "ms"))
38-
39-
def time_from_string(self):
40-
Timedelta("1 days")
41-
42-
def time_from_iso_format(self):
43-
Timedelta("P4DT12H30M5S")
44-
45-
def time_from_missing(self):
46-
Timedelta("nat")
8+
from pandas import DataFrame, Series, Timestamp, timedelta_range, to_timedelta
479

4810

4911
class ToTimedelta:
@@ -88,24 +50,6 @@ def time_add_td_ts(self):
8850
self.td + self.ts
8951

9052

91-
class TimedeltaProperties:
92-
def setup_cache(self):
93-
td = Timedelta(days=365, minutes=35, seconds=25, milliseconds=35)
94-
return td
95-
96-
def time_timedelta_days(self, td):
97-
td.days
98-
99-
def time_timedelta_seconds(self, td):
100-
td.seconds
101-
102-
def time_timedelta_microseconds(self, td):
103-
td.microseconds
104-
105-
def time_timedelta_nanoseconds(self, td):
106-
td.nanoseconds
107-
108-
10953
class DatetimeAccessor:
11054
def setup_cache(self):
11155
N = 100000
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
Benchmarks in this directory should depend only on tslibs, tseries.offsets,
3+
and to_offset.
4+
5+
i.e. any code changes that do not touch those files should not need to
6+
run these benchmarks.
7+
"""
+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
"""
2+
offsets benchmarks that rely only on tslibs. See benchmarks.offset for
3+
offsets benchmarks that rely on other parts of pandas.
4+
"""
5+
from datetime import datetime
6+
7+
import numpy as np
8+
9+
from pandas import offsets
10+
11+
try:
12+
import pandas.tseries.holiday # noqa
13+
except ImportError:
14+
pass
15+
16+
hcal = pandas.tseries.holiday.USFederalHolidayCalendar()
17+
# These offsets currently raise a NotImplimentedError with .apply_index()
18+
non_apply = [
19+
offsets.Day(),
20+
offsets.BYearEnd(),
21+
offsets.BYearBegin(),
22+
offsets.BQuarterEnd(),
23+
offsets.BQuarterBegin(),
24+
offsets.BMonthEnd(),
25+
offsets.BMonthBegin(),
26+
offsets.CustomBusinessDay(),
27+
offsets.CustomBusinessDay(calendar=hcal),
28+
offsets.CustomBusinessMonthBegin(calendar=hcal),
29+
offsets.CustomBusinessMonthEnd(calendar=hcal),
30+
offsets.CustomBusinessMonthEnd(calendar=hcal),
31+
]
32+
other_offsets = [
33+
offsets.YearEnd(),
34+
offsets.YearBegin(),
35+
offsets.QuarterEnd(),
36+
offsets.QuarterBegin(),
37+
offsets.MonthEnd(),
38+
offsets.MonthBegin(),
39+
offsets.DateOffset(months=2, days=2),
40+
offsets.BusinessDay(),
41+
offsets.SemiMonthEnd(),
42+
offsets.SemiMonthBegin(),
43+
]
44+
offset_objs = non_apply + other_offsets
45+
46+
47+
class OnOffset:
48+
49+
params = offset_objs
50+
param_names = ["offset"]
51+
52+
def setup(self, offset):
53+
self.dates = [
54+
datetime(2016, m, d)
55+
for m in [10, 11, 12]
56+
for d in [1, 2, 3, 28, 29, 30, 31]
57+
if not (m == 11 and d == 31)
58+
]
59+
60+
def time_on_offset(self, offset):
61+
for date in self.dates:
62+
offset.onOffset(date)
63+
64+
65+
class OffestDatetimeArithmetic:
66+
67+
params = offset_objs
68+
param_names = ["offset"]
69+
70+
def setup(self, offset):
71+
self.date = datetime(2011, 1, 1)
72+
self.dt64 = np.datetime64("2011-01-01 09:00Z")
73+
74+
def time_apply(self, offset):
75+
offset.apply(self.date)
76+
77+
def time_apply_np_dt64(self, offset):
78+
offset.apply(self.dt64)
79+
80+
def time_add(self, offset):
81+
self.date + offset
82+
83+
def time_add_10(self, offset):
84+
self.date + (10 * offset)
85+
86+
def time_subtract(self, offset):
87+
self.date - offset
88+
89+
def time_subtract_10(self, offset):
90+
self.date - (10 * offset)

0 commit comments

Comments
 (0)