Skip to content

Commit a1b9385

Browse files
committed
Merge remote-tracking branch 'upstream/master' into gh-36562-typeerror-comparison-not-supported-between-float-and-str
# Conflicts: # doc/source/whatsnew/v1.2.0.rst
2 parents 1320ff1 + 9cb3723 commit a1b9385

File tree

389 files changed

+12974
-10157
lines changed

Some content is hidden

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

389 files changed

+12974
-10157
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,3 @@ and the [Swift Code of Conduct][swift].
6060
[homepage]: https://www.contributor-covenant.org
6161
[version]: https://www.contributor-covenant.org/version/1/3/0/
6262
[swift]: https://swift.org/community/#code-of-conduct
63-

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ jobs:
125125
# This can be removed when the ipython directive fails when there are errors,
126126
# including the `tee sphinx.log` in te previous step (https://github.com/ipython/ipython/issues/11547)
127127
- name: Check ipython directive errors
128-
run: "! grep -B1 \"^<<<-------------------------------------------------------------------------$\" sphinx.log"
128+
run: "! grep -B10 \"^<<<-------------------------------------------------------------------------$\" sphinx.log"
129129

130130
- name: Install ssh key
131131
run: |

.pre-commit-config.yaml

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,28 @@ repos:
44
hooks:
55
- id: black
66
- repo: https://gitlab.com/pycqa/flake8
7-
rev: 3.8.3
7+
rev: 3.8.4
88
hooks:
99
- id: flake8
1010
additional_dependencies: [flake8-comprehensions>=3.1.0]
1111
- id: flake8
12-
name: flake8-pyx
13-
files: \.(pyx|pxd)$
14-
types:
15-
- file
12+
name: flake8 (cython)
13+
types: [cython]
1614
args: [--append-config=flake8/cython.cfg]
1715
- id: flake8
18-
name: flake8-pxd
16+
name: flake8 (cython template)
1917
files: \.pxi\.in$
2018
types:
2119
- file
2220
args: [--append-config=flake8/cython-template.cfg]
2321
- repo: https://github.com/PyCQA/isort
24-
rev: 5.2.2
22+
rev: 5.6.3
2523
hooks:
2624
- id: isort
27-
exclude: ^pandas/__init__\.py$|^pandas/core/api\.py$
25+
name: isort (python)
26+
- id: isort
27+
name: isort (cython)
28+
types: [cython]
2829
- repo: https://github.com/asottile/pyupgrade
2930
rev: v2.7.2
3031
hooks:
@@ -39,7 +40,25 @@ repos:
3940
- id: pip_to_conda
4041
name: Generate pip dependency from conda
4142
description: This hook checks if the conda environment.yml and requirements-dev.txt are equal
42-
language: system
43+
language: python
4344
entry: python -m scripts.generate_pip_deps_from_conda
4445
files: ^(environment.yml|requirements-dev.txt)$
4546
pass_filenames: false
47+
additional_dependencies: [pyyaml]
48+
- id: flake8-rst
49+
name: flake8-rst
50+
description: Run flake8 on code snippets in docstrings or RST files
51+
language: python
52+
entry: flake8-rst
53+
types: [rst]
54+
args: [--filename=*.rst]
55+
additional_dependencies: [flake8-rst==0.7.0, flake8==3.7.9]
56+
- repo: https://github.com/asottile/yesqa
57+
rev: v1.2.2
58+
hooks:
59+
- id: yesqa
60+
- repo: https://github.com/pre-commit/pre-commit-hooks
61+
rev: v3.2.0
62+
hooks:
63+
- id: end-of-file-fixer
64+
exclude: '.html$|^LICENSES/|.csv$|.txt$|.svg$|.py$'

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ matrix:
4141
- JOB="3.9-dev" PATTERN="(not slow and not network and not clipboard)"
4242

4343
- env:
44-
- JOB="3.8" ENV_FILE="ci/deps/travis-38.yaml" PATTERN="(not slow and not network and not clipboard)"
45-
46-
- env:
47-
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="(not slow and not network and not clipboard)"
44+
- JOB="3.8, slow" ENV_FILE="ci/deps/travis-38-slow.yaml" PATTERN="slow" SQL="1"
45+
services:
46+
- mysql
47+
- postgresql
4848

4949
- env:
5050
- 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"

AUTHORS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,3 @@ pandas is distributed under a 3-clause ("Simplified" or "New") BSD
5454
license. Parts of NumPy, SciPy, numpydoc, bottleneck, which all have
5555
BSD-compatible licenses, are included. Their licenses follow the pandas
5656
license.
57-

asv_bench/benchmarks/dtypes.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1+
import string
2+
13
import numpy as np
24

5+
from pandas import DataFrame
6+
import pandas._testing as tm
37
from pandas.api.types import pandas_dtype
48

59
from .pandas_vb_common import (
@@ -62,4 +66,57 @@ def time_infer(self, dtype):
6266
lib.infer_dtype(self.data_dict[dtype], skipna=False)
6367

6468

69+
class SelectDtypes:
70+
71+
params = [
72+
tm.ALL_INT_DTYPES
73+
+ tm.ALL_EA_INT_DTYPES
74+
+ tm.FLOAT_DTYPES
75+
+ tm.COMPLEX_DTYPES
76+
+ tm.DATETIME64_DTYPES
77+
+ tm.TIMEDELTA64_DTYPES
78+
+ tm.BOOL_DTYPES
79+
]
80+
param_names = ["dtype"]
81+
82+
def setup(self, dtype):
83+
N, K = 5000, 50
84+
self.index = tm.makeStringIndex(N)
85+
self.columns = tm.makeStringIndex(K)
86+
87+
def create_df(data):
88+
return DataFrame(data, index=self.index, columns=self.columns)
89+
90+
self.df_int = create_df(np.random.randint(low=100, size=(N, K)))
91+
self.df_float = create_df(np.random.randn(N, K))
92+
self.df_bool = create_df(np.random.choice([True, False], size=(N, K)))
93+
self.df_string = create_df(
94+
np.random.choice(list(string.ascii_letters), size=(N, K))
95+
)
96+
97+
def time_select_dtype_int_include(self, dtype):
98+
self.df_int.select_dtypes(include=dtype)
99+
100+
def time_select_dtype_int_exclude(self, dtype):
101+
self.df_int.select_dtypes(exclude=dtype)
102+
103+
def time_select_dtype_float_include(self, dtype):
104+
self.df_float.select_dtypes(include=dtype)
105+
106+
def time_select_dtype_float_exclude(self, dtype):
107+
self.df_float.select_dtypes(exclude=dtype)
108+
109+
def time_select_dtype_bool_include(self, dtype):
110+
self.df_bool.select_dtypes(include=dtype)
111+
112+
def time_select_dtype_bool_exclude(self, dtype):
113+
self.df_bool.select_dtypes(exclude=dtype)
114+
115+
def time_select_dtype_string_include(self, dtype):
116+
self.df_string.select_dtypes(include=dtype)
117+
118+
def time_select_dtype_string_exclude(self, dtype):
119+
self.df_string.select_dtypes(exclude=dtype)
120+
121+
65122
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ def setup(self, index):
191191
}
192192
index = indexes[index]
193193
self.s = Series(np.random.rand(N), index=index)
194-
self.indexer = [True, False, True, True, False] * 20000
194+
self.indexer = np.random.randint(0, N, size=N)
195195

196196
def time_take(self, index):
197197
self.s.take(self.indexer)

asv_bench/benchmarks/pandas_vb_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# Compatibility import for the testing module
1717
try:
18-
import pandas._testing as tm # noqa
18+
import pandas._testing as tm
1919
except ImportError:
2020
import pandas.util.testing as tm # noqa
2121

asv_bench/benchmarks/rolling.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,12 +76,21 @@ class ExpandingMethods:
7676

7777
def setup(self, constructor, dtype, method):
7878
N = 10 ** 5
79+
N_groupby = 100
7980
arr = (100 * np.random.random(N)).astype(dtype)
8081
self.expanding = getattr(pd, constructor)(arr).expanding()
82+
self.expanding_groupby = (
83+
pd.DataFrame({"A": arr[:N_groupby], "B": range(N_groupby)})
84+
.groupby("B")
85+
.expanding()
86+
)
8187

8288
def time_expanding(self, constructor, dtype, method):
8389
getattr(self.expanding, method)()
8490

91+
def time_expanding_groupby(self, constructor, dtype, method):
92+
getattr(self.expanding_groupby, method)()
93+
8594

8695
class EWMMethods:
8796

asv_bench/benchmarks/tslibs/offsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from pandas import offsets
1010

1111
try:
12-
import pandas.tseries.holiday # noqa
12+
import pandas.tseries.holiday
1313
except ImportError:
1414
pass
1515

ci/azure/posix.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,35 @@ jobs:
2020
CONDA_PY: "37"
2121
PATTERN: "not slow and not network and not clipboard"
2222

23+
py37:
24+
ENV_FILE: ci/deps/azure-37.yaml
25+
CONDA_PY: "37"
26+
PATTERN: "not slow and not network and not clipboard"
27+
2328
py37_locale_slow:
2429
ENV_FILE: ci/deps/azure-37-locale_slow.yaml
2530
CONDA_PY: "37"
2631
PATTERN: "slow"
27-
# pandas does not use the language (zh_CN), but should support different encodings (utf8)
28-
# we should test with encodings different than utf8, but doesn't seem like Ubuntu supports any
29-
LANG: "zh_CN.utf8"
30-
LC_ALL: "zh_CN.utf8"
31-
EXTRA_APT: "language-pack-zh-hans"
32+
LANG: "it_IT.utf8"
33+
LC_ALL: "it_IT.utf8"
34+
EXTRA_APT: "language-pack-it xsel"
3235

3336
py37_slow:
3437
ENV_FILE: ci/deps/azure-37-slow.yaml
3538
CONDA_PY: "37"
3639
PATTERN: "slow"
3740

38-
py37_locale:
39-
ENV_FILE: ci/deps/azure-37-locale.yaml
40-
CONDA_PY: "37"
41-
PATTERN: "not slow and not network"
42-
LANG: "it_IT.utf8"
43-
LC_ALL: "it_IT.utf8"
44-
EXTRA_APT: "language-pack-it xsel"
45-
46-
# py37_32bit:
47-
# ENV_FILE: ci/deps/azure-37-32bit.yaml
48-
# CONDA_PY: "37"
49-
# PATTERN: "not slow and not network and not clipboard"
50-
# BITS32: "yes"
41+
py38:
42+
ENV_FILE: ci/deps/azure-38.yaml
43+
CONDA_PY: "38"
44+
PATTERN: "not slow and not network and not clipboard"
5145

5246
py38_locale:
5347
ENV_FILE: ci/deps/azure-38-locale.yaml
5448
CONDA_PY: "38"
5549
PATTERN: "not slow and not network"
50+
# pandas does not use the language (zh_CN), but should support different encodings (utf8)
51+
# we should test with encodings different than utf8, but doesn't seem like Ubuntu supports any
5652
LANG: "zh_CN.utf8"
5753
LC_ALL: "zh_CN.utf8"
5854
EXTRA_APT: "language-pack-zh-hans xsel"

ci/code_checks.sh

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
7373
flake8 --format="$FLAKE8_FORMAT" pandas/_libs --append-config=flake8/cython-template.cfg
7474
RET=$(($RET + $?)) ; echo $MSG "DONE"
7575

76-
echo "flake8-rst --version"
77-
flake8-rst --version
78-
79-
MSG='Linting code-blocks in .rst documentation' ; echo $MSG
80-
flake8-rst doc/source --filename=*.rst --format="$FLAKE8_FORMAT"
81-
RET=$(($RET + $?)) ; echo $MSG "DONE"
82-
8376
# Check that cython casting is of the form `<type>obj` as opposed to `<type> obj`;
8477
# it doesn't make a difference, but we want to be internally consistent.
8578
# Note: this grep pattern is (intended to be) equivalent to the python

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

Lines changed: 0 additions & 26 deletions
This file was deleted.

ci/deps/azure-37-slow.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies:
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0
13+
- pytest-azurepipelines
1314

1415
# pandas dependencies
1516
- beautifulsoup4

ci/deps/travis-37.yaml renamed to ci/deps/azure-37.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ dependencies:
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0
13+
- pytest-azurepipelines
1314

1415
# pandas dependencies
1516
- botocore>=1.11

ci/deps/travis-38.yaml renamed to ci/deps/azure-38.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ dependencies:
1010
- pytest>=5.0.1
1111
- pytest-xdist>=1.21
1212
- hypothesis>=3.58.0
13+
- pytest-azurepipelines
1314

1415
# pandas dependencies
1516
- numpy
1617
- python-dateutil
1718
- nomkl
1819
- pytz
19-
- pip
2020
- tabulate==0.8.3

ci/deps/travis-37-cov.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ dependencies:
3232
- google-cloud-bigquery>=1.27.2 # GH 36436
3333
- psycopg2
3434
- pyarrow>=0.15.0
35-
- pymysql=0.7.11
35+
- pymysql<0.10.0 # temporary pin, GH 36465
3636
- pytables
3737
- python-snappy
3838
- python-dateutil
3939
- pytz
4040
- s3fs>=0.4.0
4141
- scikit-learn
4242
- scipy
43-
- sqlalchemy=1.3.0
43+
- sqlalchemy
4444
- statsmodels
4545
- xarray
4646
- xlrd

0 commit comments

Comments
 (0)