Skip to content

Commit 344687f

Browse files
committed
Merge branch 'master' into issue4889
2 parents 1ef32fc + 3b12293 commit 344687f

File tree

613 files changed

+22137
-10841
lines changed

Some content is hidden

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

613 files changed

+22137
-10841
lines changed

.github/workflows/ci.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ on:
44
push:
55
branches: master
66
pull_request:
7-
branches: master
7+
branches:
8+
- master
9+
- 1.1.x
810

911
env:
1012
ENV_FILE: environment.yml

.github/workflows/pre-commit.yml

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

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

+43-20
Original file line numberDiff line numberDiff line change
@@ -1,44 +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$
33-
- repo: https://github.com/pre-commit/mirrors-mypy
34-
rev: v0.730
28+
- repo: https://github.com/asottile/pyupgrade
29+
rev: v2.7.2
3530
hooks:
36-
- id: mypy
37-
args:
38-
# As long as a some files are excluded from check-untyped-defs
39-
# we have to exclude it from the pre-commit hook as the configuration
40-
# is based on modules but the hook runs on files.
41-
- --no-check-untyped-defs
42-
- --follow-imports
43-
- skip
44-
files: pandas/
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

+13-20
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,10 +48,10 @@ 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:
48-
- JOB="3.6, locale" ENV_FILE="ci/deps/travis-36-locale.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" LOCALE_OVERRIDE="zh_CN.UTF-8" SQL="1"
54+
- 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"
4955
services:
5056
- mysql
5157
- postgresql
@@ -54,17 +60,10 @@ matrix:
5460
# Enabling Deprecations when running tests
5561
# PANDAS_TESTING_MODE="deprecate" causes DeprecationWarning messages to be displayed in the logs
5662
# See pandas/_testing.py for more details.
57-
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36-cov.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true SQL="1"
63+
- JOB="3.7, coverage" ENV_FILE="ci/deps/travis-37-cov.yaml" PATTERN="((not slow and not network and not clipboard) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true SQL="1"
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"

Makefile

+13
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,16 @@ doc:
2525
cd doc; \
2626
python make.py clean; \
2727
python make.py html
28+
29+
check:
30+
python3 scripts/validate_unwanted_patterns.py \
31+
--validation-type="private_function_across_module" \
32+
--included-file-extensions="py" \
33+
--excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored \
34+
pandas/
35+
36+
python3 scripts/validate_unwanted_patterns.py \
37+
--validation-type="private_import_across_module" \
38+
--included-file-extensions="py" \
39+
--excluded-file-paths=pandas/tests,asv_bench/,pandas/_vendored,doc/
40+
pandas/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ its way towards this goal.
3232
Here are just a few of the things that pandas does well:
3333

3434
- Easy handling of [**missing data**][missing-data] (represented as
35-
`NaN`) in floating point as well as non-floating point data
35+
`NaN`, `NA`, or `NaT`) in floating point as well as non-floating point data
3636
- Size mutability: columns can be [**inserted and
3737
deleted**][insertion-deletion] from DataFrame and higher dimensional
3838
objects

asv_bench/asv.conf.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
// The Pythons you'd like to test against. If not provided, defaults
2727
// to the current version of Python used to run `asv`.
2828
// "pythons": ["2.7", "3.4"],
29-
"pythons": ["3.6"],
29+
"pythons": ["3.8"],
3030

3131
// The matrix of dependencies to test. Each key is the name of a
3232
// package (in PyPI) and the values are version numbers. An empty
@@ -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

+1-1
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_ctor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from .pandas_vb_common import tm
77

88
try:
9-
from pandas.tseries.offsets import Nano, Hour
9+
from pandas.tseries.offsets import Hour, Nano
1010
except ImportError:
1111
# For compatibility with older versions
1212
from pandas.core.datetools import * # noqa

asv_bench/benchmarks/frame_methods.py

+40
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/gil.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@
77

88
try:
99
from pandas import (
10-
rolling_median,
10+
rolling_kurt,
11+
rolling_max,
1112
rolling_mean,
13+
rolling_median,
1214
rolling_min,
13-
rolling_max,
14-
rolling_var,
1515
rolling_skew,
16-
rolling_kurt,
1716
rolling_std,
17+
rolling_var,
1818
)
1919

2020
have_rolling_methods = True

0 commit comments

Comments
 (0)