Skip to content

Commit a4131d2

Browse files
committed
Merge remote-tracking branch 'upstream/master' into io-parquet-multiindex
2 parents 3ba38fa + 3b12293 commit a4131d2

File tree

229 files changed

+4154
-3012
lines changed

Some content is hidden

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

229 files changed

+4154
-3012
lines changed

.github/workflows/pre-commit.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: pre-commit
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [master]
7+
8+
jobs:
9+
pre-commit:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
- uses: pre-commit/[email protected]

.github/workflows/stale-pr.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: "Stale PRs"
2+
on:
3+
schedule:
4+
# * is a special character in YAML so you have to quote this string
5+
- cron: "0 */6 * * *"
6+
7+
jobs:
8+
stale:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/stale@v3
12+
with:
13+
repo-token: ${{ secrets.GITHUB_TOKEN }}
14+
stale-pr-message: "This pull request is stale because it has been open for thirty days with no activity."
15+
skip-stale-pr-message: true
16+
stale-pr-label: "Stale"
17+
exempt-pr-labels: "Needs Review,Blocked,Needs Discussion"
18+
days-before-stale: 30
19+
days-before-close: -1
20+
remove-stale-when-updated: false
21+
debug-only: false

.pre-commit-config.yaml

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,67 @@
11
repos:
22
- repo: https://github.com/python/black
3-
rev: 19.10b0
3+
rev: 20.8b1
44
hooks:
55
- id: black
6-
language_version: python3
76
- repo: https://gitlab.com/pycqa/flake8
8-
rev: 3.7.7
7+
rev: 3.8.3
98
hooks:
109
- id: flake8
11-
language: python_venv
1210
additional_dependencies: [flake8-comprehensions>=3.1.0]
1311
- id: flake8
1412
name: flake8-pyx
15-
language: python_venv
1613
files: \.(pyx|pxd)$
1714
types:
1815
- file
1916
args: [--append-config=flake8/cython.cfg]
2017
- id: flake8
2118
name: flake8-pxd
22-
language: python_venv
2319
files: \.pxi\.in$
2420
types:
2521
- file
2622
args: [--append-config=flake8/cython-template.cfg]
27-
- repo: https://github.com/pre-commit/mirrors-isort
28-
rev: v4.3.21
23+
- repo: https://github.com/PyCQA/isort
24+
rev: 5.2.2
2925
hooks:
3026
- id: isort
31-
language: python_venv
3227
exclude: ^pandas/__init__\.py$|^pandas/core/api\.py$
28+
- repo: https://github.com/asottile/pyupgrade
29+
rev: v2.7.2
30+
hooks:
31+
- id: pyupgrade
32+
args: [--py37-plus]
33+
- repo: https://github.com/pre-commit/pygrep-hooks
34+
rev: v1.6.0
35+
hooks:
36+
- id: rst-backticks
37+
# these exclusions should be removed and the files fixed
38+
exclude: (?x)(
39+
text\.rst|
40+
timeseries\.rst|
41+
visualization\.rst|
42+
missing_data\.rst|
43+
options\.rst|
44+
reshaping\.rst|
45+
scale\.rst|
46+
merging\.rst|
47+
cookbook\.rst|
48+
enhancingperf\.rst|
49+
groupby\.rst|
50+
io\.rst|
51+
overview\.rst|
52+
panel\.rst|
53+
plotting\.rst|
54+
10min\.rst|
55+
basics\.rst|
56+
categorical\.rst|
57+
contributing\.rst|
58+
contributing_docstring\.rst|
59+
extending\.rst|
60+
ecosystem\.rst|
61+
comparison_with_sql\.rst|
62+
install\.rst|
63+
calculate_statistics\.rst|
64+
combine_dataframes\.rst|
65+
v0\.|
66+
v1\.0\.|
67+
v1\.1\.[012])

.travis.yml

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
language: python
22
python: 3.7
33

4+
addons:
5+
apt:
6+
update: true
7+
packages:
8+
- xvfb
9+
10+
services:
11+
- xvfb
12+
413
# To turn off cached cython files and compiler cache
514
# set NOCACHE-true
615
# To delete caches go to https://travis-ci.org/OWNER/REPOSITORY/caches or run
@@ -10,30 +19,27 @@ cache:
1019
ccache: true
1120
directories:
1221
- $HOME/.cache # cython cache
13-
- $HOME/.ccache # compiler cache
1422

1523
env:
1624
global:
17-
# Variable for test workers
1825
- PYTEST_WORKERS="auto"
1926
# create a github personal access token
2027
# cd pandas-dev/pandas
2128
# travis encrypt 'PANDAS_GH_TOKEN=personal_access_token' -r pandas-dev/pandas
2229
- secure: "EkWLZhbrp/mXJOx38CHjs7BnjXafsqHtwxPQrqWy457VDFWhIY1DMnIR/lOWG+a20Qv52sCsFtiZEmMfUjf0pLGXOqurdxbYBGJ7/ikFLk9yV2rDwiArUlVM9bWFnFxHvdz9zewBH55WurrY4ShZWyV+x2dWjjceWG5VpWeI6sA="
2330

2431
git:
25-
# for cloning
2632
depth: false
2733

2834
matrix:
2935
fast_finish: true
3036

3137
include:
32-
# In allowed failures
3338
- dist: bionic
3439
python: 3.9-dev
3540
env:
3641
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
42+
3743
- env:
3844
- JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network and not clipboard)"
3945

@@ -42,7 +48,7 @@ matrix:
4248

4349
- arch: arm64
4450
env:
45-
- JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"
51+
- JOB="3.7, arm64" PYTEST_WORKERS=1 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard and not arm_slow)"
4652

4753
- env:
4854
- JOB="3.7, locale" ENV_FILE="ci/deps/travis-37-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
@@ -58,13 +64,6 @@ matrix:
5864
services:
5965
- mysql
6066
- postgresql
61-
allow_failures:
62-
- arch: arm64
63-
env:
64-
- JOB="3.7, arm64" PYTEST_WORKERS=8 ENV_FILE="ci/deps/travis-37-arm64.yaml" PATTERN="(not slow and not network and not clipboard)"
65-
- dist: bionic
66-
env:
67-
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
6867

6968

7069
before_install:
@@ -78,12 +77,6 @@ before_install:
7877
- uname -a
7978
- git --version
8079
- ./ci/check_git_tags.sh
81-
# Because travis runs on Google Cloud and has a /etc/boto.cfg,
82-
# it breaks moto import, see:
83-
# https://github.com/spulec/moto/issues/1771
84-
# https://github.com/boto/boto/issues/3741
85-
# This overrides travis and tells it to look nowhere.
86-
- export BOTO_CONFIG=/dev/null
8780

8881
install:
8982
- echo "install start"

asv_bench/asv.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
// followed by the pip installed packages).
4040
"matrix": {
4141
"numpy": [],
42-
"Cython": ["0.29.16"],
42+
"Cython": ["0.29.21"],
4343
"matplotlib": [],
4444
"sqlalchemy": [],
4545
"scipy": [],

asv_bench/benchmarks/arithmetic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def setup(self, op):
125125
arr1 = np.random.randn(n_rows, int(n_cols / 2)).astype("f8")
126126
arr2 = np.random.randn(n_rows, int(n_cols / 2)).astype("f4")
127127
df = pd.concat(
128-
[pd.DataFrame(arr1), pd.DataFrame(arr2)], axis=1, ignore_index=True,
128+
[pd.DataFrame(arr1), pd.DataFrame(arr2)], axis=1, ignore_index=True
129129
)
130130
# should already be the case, but just to be sure
131131
df._consolidate_inplace()

asv_bench/benchmarks/frame_methods.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,46 @@ def time_to_html_mixed(self):
219219
self.df2.to_html()
220220

221221

222+
class ToNumpy:
223+
def setup(self):
224+
N = 10000
225+
M = 10
226+
self.df_tall = DataFrame(np.random.randn(N, M))
227+
self.df_wide = DataFrame(np.random.randn(M, N))
228+
self.df_mixed_tall = self.df_tall.copy()
229+
self.df_mixed_tall["foo"] = "bar"
230+
self.df_mixed_tall[0] = period_range("2000", periods=N)
231+
self.df_mixed_tall[1] = range(N)
232+
self.df_mixed_wide = self.df_wide.copy()
233+
self.df_mixed_wide["foo"] = "bar"
234+
self.df_mixed_wide[0] = period_range("2000", periods=M)
235+
self.df_mixed_wide[1] = range(M)
236+
237+
def time_to_numpy_tall(self):
238+
self.df_tall.to_numpy()
239+
240+
def time_to_numpy_wide(self):
241+
self.df_wide.to_numpy()
242+
243+
def time_to_numpy_mixed_tall(self):
244+
self.df_mixed_tall.to_numpy()
245+
246+
def time_to_numpy_mixed_wide(self):
247+
self.df_mixed_wide.to_numpy()
248+
249+
def time_values_tall(self):
250+
self.df_tall.values
251+
252+
def time_values_wide(self):
253+
self.df_wide.values
254+
255+
def time_values_mixed_tall(self):
256+
self.df_mixed_tall.values
257+
258+
def time_values_mixed_wide(self):
259+
self.df_mixed_wide.values
260+
261+
222262
class Repr:
223263
def setup(self):
224264
nrows = 10000

asv_bench/benchmarks/strings.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,20 @@ class Construction:
1313
param_names = ["dtype"]
1414

1515
def setup(self, dtype):
16-
self.data = tm.rands_array(nchars=10 ** 5, size=10)
16+
self.series_arr = tm.rands_array(nchars=10, size=10 ** 5)
17+
self.frame_arr = self.series_arr.reshape((50_000, 2)).copy()
1718

18-
def time_construction(self, dtype):
19-
Series(self.data, dtype=dtype)
19+
def time_series_construction(self, dtype):
20+
Series(self.series_arr, dtype=dtype)
2021

21-
def peakmem_construction(self, dtype):
22-
Series(self.data, dtype=dtype)
22+
def peakmem_series_construction(self, dtype):
23+
Series(self.series_arr, dtype=dtype)
24+
25+
def time_frame_construction(self, dtype):
26+
DataFrame(self.frame_arr, dtype=dtype)
27+
28+
def peakmem_frame_construction(self, dtype):
29+
DataFrame(self.frame_arr, dtype=dtype)
2330

2431

2532
class Methods:

asv_bench/benchmarks/timeseries.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,29 @@ def time_lookup_and_cleanup(self):
263263
self.ts.index._cleanup()
264264

265265

266+
class ToDatetimeFromIntsFloats:
267+
def setup(self):
268+
self.ts_sec = Series(range(1521080307, 1521685107), dtype="int64")
269+
self.ts_sec_float = self.ts_sec.astype("float64")
270+
271+
self.ts_nanosec = 1_000_000 * self.ts_sec
272+
self.ts_nanosec_float = self.ts_nanosec.astype("float64")
273+
274+
# speed of int64 and float64 paths should be comparable
275+
276+
def time_nanosec_int64(self):
277+
to_datetime(self.ts_nanosec, unit="ns")
278+
279+
def time_nanosec_float64(self):
280+
to_datetime(self.ts_nanosec_float, unit="ns")
281+
282+
def time_sec_int64(self):
283+
to_datetime(self.ts_sec, unit="s")
284+
285+
def time_sec_float64(self):
286+
to_datetime(self.ts_sec_float, unit="s")
287+
288+
266289
class ToDatetimeYYYYMMDD:
267290
def setup(self):
268291
rng = date_range(start="1/1/2000", periods=10000, freq="D")

ci/build39.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
#!/bin/bash -e
22
# Special build for python3.9 until numpy puts its own wheels up
33

4-
sudo apt-get install build-essential gcc xvfb
54
pip install --no-deps -U pip wheel setuptools
6-
pip install numpy python-dateutil pytz pytest pytest-xdist hypothesis
7-
pip install cython --pre # https://github.com/cython/cython/issues/3395
5+
pip install cython numpy python-dateutil pytz pytest pytest-xdist hypothesis
86

97
python setup.py build_ext -inplace
108
python -m pip install --no-build-isolation -e .

ci/deps/azure-37-32bit.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ dependencies:
2121
# see comment above
2222
- pip
2323
- pip:
24-
- cython>=0.29.16
24+
- cython>=0.29.21
2525
- numpy>=1.16.5
2626
- pytest>=5.0.1

ci/deps/azure-37-locale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.7.*
77

88
# tools
9-
- cython>=0.29.16
9+
- cython>=0.29.21
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- pytest-asyncio

ci/deps/azure-37-locale_slow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.7.*
77

88
# tools
9-
- cython>=0.29.16
9+
- cython>=0.29.21
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0

ci/deps/azure-37-minimum_versions.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.7.1
66

77
# tools
8-
- cython=0.29.16
8+
- cython=0.29.21
99
- pytest=5.0.1
1010
- pytest-xdist>=1.21
1111
- hypothesis>=3.58.0

ci/deps/azure-37-slow.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ dependencies:
66
- python=3.7.*
77

88
# tools
9-
- cython>=0.29.16
9+
- cython>=0.29.21
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0

ci/deps/azure-38-locale.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ dependencies:
55
- python=3.8.*
66

77
# tools
8-
- cython>=0.29.16
8+
- cython>=0.29.21
99
- pytest>=5.0.1
1010
- pytest-xdist>=1.21
1111
- pytest-asyncio>=0.12.0

ci/deps/azure-38-numpydev.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- pytz
1515
- pip
1616
- pip:
17-
- cython==0.29.16 # GH#34014
17+
- cython==0.29.21 # GH#34014
1818
- "git+git://github.com/dateutil/dateutil.git"
1919
- "--extra-index-url https://pypi.anaconda.org/scipy-wheels-nightly/simple"
2020
- "--pre"

0 commit comments

Comments
 (0)