Skip to content

Commit 1722437

Browse files
committed
Merge remote-tracking branch 'upstream/master' into yanglinlee-json_improve
2 parents 1c186aa + 802f670 commit 1722437

File tree

234 files changed

+5169
-4452
lines changed

Some content is hidden

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

234 files changed

+5169
-4452
lines changed

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
custom: https://pandas.pydata.org/donate.html
2+
tidelift: pypi/pandas

.github/SECURITY.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
To report a security vulnerability to pandas, please go to https://tidelift.com/security and see the instructions there.

.pre-commit-config.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ repos:
99
hooks:
1010
- id: flake8
1111
language: python_venv
12+
additional_dependencies: [flake8-comprehensions]
1213
- repo: https://github.com/pre-commit/mirrors-isort
1314
rev: v4.3.20
1415
hooks:

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ env:
2121

2222
git:
2323
# for cloning
24-
depth: 2000
24+
depth: false
2525

2626
matrix:
2727
fast_finish: true
@@ -63,7 +63,7 @@ before_install:
6363
- pwd
6464
- uname -a
6565
- git --version
66-
- git tag
66+
- ./ci/check_git_tags.sh
6767
# Because travis runs on Google Cloud and has a /etc/boto.cfg,
6868
# it breaks moto import, see:
6969
# https://github.com/spulec/moto/issues/1771

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -233,3 +233,5 @@ You can also triage issues which may include reproducing bug reports, or asking
233233
Or maybe through using pandas you have an idea of your own or are looking for something in the documentation and thinking ‘this can be improved’...you can do something about it!
234234

235235
Feel free to ask questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/pydata) or on [Gitter](https://gitter.im/pydata/pandas).
236+
237+
As contributors and maintainers to this project, you are expected to abide by pandas' code of conduct. More information can be found at: [Contributor Code of Conduct](https://github.com/pandas-dev/pandas/blob/master/.github/CODE_OF_CONDUCT.md)

asv_bench/benchmarks/index_object.py

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import gc
12
import numpy as np
23
import pandas.util.testing as tm
34
from pandas import (
@@ -225,4 +226,21 @@ def time_intersection_both_duplicate(self, N):
225226
self.intv.intersection(self.intv2)
226227

227228

229+
class GC:
230+
params = [1, 2, 5]
231+
232+
def create_use_drop(self):
233+
idx = Index(list(range(1000 * 1000)))
234+
idx._engine
235+
236+
def peakmem_gc_instances(self, N):
237+
try:
238+
gc.disable()
239+
240+
for _ in range(N):
241+
self.create_use_drop()
242+
finally:
243+
gc.enable()
244+
245+
228246
from .pandas_vb_common import setup # noqa: F401

asv_bench/benchmarks/reshape.py

+9
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def setup(self, bins):
214214
self.datetime_series = pd.Series(
215215
np.random.randint(N, size=N), dtype="datetime64[ns]"
216216
)
217+
self.interval_bins = pd.IntervalIndex.from_breaks(np.linspace(0, N, bins))
217218

218219
def time_cut_int(self, bins):
219220
pd.cut(self.int_series, bins)
@@ -239,6 +240,14 @@ def time_qcut_timedelta(self, bins):
239240
def time_qcut_datetime(self, bins):
240241
pd.qcut(self.datetime_series, bins)
241242

243+
def time_cut_interval(self, bins):
244+
# GH 27668
245+
pd.cut(self.int_series, self.interval_bins)
246+
247+
def peakmem_cut_interval(self, bins):
248+
# GH 27668
249+
pd.cut(self.int_series, self.interval_bins)
250+
242251

243252
class Explode:
244253
param_names = ["n_rows", "max_list_length"]

azure-pipelines.yml

+4-18
Original file line numberDiff line numberDiff line change
@@ -22,80 +22,67 @@ jobs:
2222
timeoutInMinutes: 90
2323
steps:
2424
- script: |
25-
# XXX next command should avoid redefining the path in every step, but
26-
# made the process crash as it couldn't find deactivate
27-
#echo '##vso[task.prependpath]$HOME/miniconda3/bin'
25+
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
2826
echo '##vso[task.setvariable variable=ENV_FILE]environment.yml'
2927
echo '##vso[task.setvariable variable=AZURE]true'
3028
displayName: 'Setting environment variables'
3129
3230
# Do not require a conda environment
33-
- script: |
34-
export PATH=$HOME/miniconda3/bin:$PATH
35-
ci/code_checks.sh patterns
31+
- script: ci/code_checks.sh patterns
3632
displayName: 'Looking for unwanted patterns'
3733
condition: true
3834

3935
- script: |
40-
export PATH=$HOME/miniconda3/bin:$PATH
4136
sudo apt-get install -y libc6-dev-i386
4237
ci/setup_env.sh
4338
displayName: 'Setup environment and build pandas'
4439
condition: true
4540
4641
# Do not require pandas
4742
- script: |
48-
export PATH=$HOME/miniconda3/bin:$PATH
4943
source activate pandas-dev
5044
ci/code_checks.sh lint
5145
displayName: 'Linting'
5246
condition: true
5347
5448
- script: |
55-
export PATH=$HOME/miniconda3/bin:$PATH
5649
source activate pandas-dev
5750
ci/code_checks.sh dependencies
5851
displayName: 'Dependencies consistency'
5952
condition: true
6053
6154
# Require pandas
6255
- script: |
63-
export PATH=$HOME/miniconda3/bin:$PATH
6456
source activate pandas-dev
6557
ci/code_checks.sh code
6658
displayName: 'Checks on imported code'
6759
condition: true
6860
6961
- script: |
70-
export PATH=$HOME/miniconda3/bin:$PATH
7162
source activate pandas-dev
7263
ci/code_checks.sh doctests
7364
displayName: 'Running doctests'
7465
condition: true
7566
7667
- script: |
77-
export PATH=$HOME/miniconda3/bin:$PATH
7868
source activate pandas-dev
7969
ci/code_checks.sh docstrings
8070
displayName: 'Docstring validation'
8171
condition: true
8272
8373
- script: |
84-
export PATH=$HOME/miniconda3/bin:$PATH
8574
source activate pandas-dev
8675
ci/code_checks.sh typing
8776
displayName: 'Typing validation'
8877
condition: true
8978
9079
- script: |
91-
export PATH=$HOME/miniconda3/bin:$PATH
9280
source activate pandas-dev
9381
pytest --capture=no --strict scripts
94-
displayName: 'Testing docstring validaton script'
82+
displayName: 'Testing docstring validation script'
9583
condition: true
9684
9785
- script: |
98-
export PATH=$HOME/miniconda3/bin:$PATH
9986
source activate pandas-dev
10087
cd asv_bench
10188
asv check -E existing
@@ -124,16 +111,15 @@ jobs:
124111
steps:
125112
- script: |
126113
echo '##vso[task.setvariable variable=ENV_FILE]environment.yml'
114+
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
127115
displayName: 'Setting environment variables'
128116
129117
- script: |
130-
export PATH=$HOME/miniconda3/bin:$PATH
131118
sudo apt-get install -y libc6-dev-i386
132119
ci/setup_env.sh
133120
displayName: 'Setup environment and build pandas'
134121
135122
- script: |
136-
export PATH=$HOME/miniconda3/bin:$PATH
137123
source activate pandas-dev
138124
# Next we should simply have `doc/make.py --warnings-are-errors`, everything else is required because the ipython directive doesn't fail the build on errors (https://github.com/ipython/ipython/issues/11547)
139125
doc/make.py --warnings-are-errors | tee sphinx.log ; SPHINX_RET=${PIPESTATUS[0]}

ci/azure/posix.yml

+2-5
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,15 @@ jobs:
5656
steps:
5757
- script: |
5858
if [ "$(uname)" == "Linux" ]; then sudo apt-get install -y libc6-dev-i386 $EXTRA_APT; fi
59+
echo '##vso[task.prependpath]$(HOME)/miniconda3/bin'
5960
echo "Creating Environment"
6061
ci/setup_env.sh
6162
displayName: 'Setup environment and build pandas'
6263
- script: |
63-
export PATH=$HOME/miniconda3/bin:$PATH
6464
source activate pandas-dev
6565
ci/run_tests.sh
6666
displayName: 'Test'
67-
- script: |
68-
export PATH=$HOME/miniconda3/bin:$PATH
69-
source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
67+
- script: source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
7068
- task: PublishTestResults@2
7169
inputs:
7270
testResultsFiles: 'test-data-*.xml'
@@ -97,7 +95,6 @@ jobs:
9795
}
9896
displayName: 'Check for test failures'
9997
- script: |
100-
export PATH=$HOME/miniconda3/bin:$PATH
10198
source activate pandas-dev
10299
python ci/print_skipped.py
103100
displayName: 'Print skipped tests'

ci/azure/windows.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
CONDA_PY: "37"
1818

1919
steps:
20-
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
20+
- powershell: |
21+
Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
22+
Write-Host "##vso[task.prependpath]$HOME/miniconda3/bin"
2123
displayName: 'Add conda to PATH'
2224
- script: conda update -q -n base conda
2325
displayName: Update conda
@@ -52,7 +54,6 @@ jobs:
5254
}
5355
displayName: 'Check for test failures'
5456
- script: |
55-
export PATH=$HOME/miniconda3/bin:$PATH
5657
source activate pandas-dev
5758
python ci/print_skipped.py
5859
displayName: 'Print skipped tests'

ci/check_git_tags.sh

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
set -e
2+
3+
if [[ ! $(git tag) ]]; then
4+
echo "No git tags in clone, please sync your git tags with upstream using:"
5+
echo " git fetch --tags upstream"
6+
echo " git push --tags origin"
7+
echo ""
8+
echo "If the issue persists, the clone depth needs to be increased in .travis.yml"
9+
exit 1
10+
fi
11+
12+
# This will error if there are no tags and we omit --always
13+
DESCRIPTION=$(git describe --long --tags)
14+
echo "$DESCRIPTION"
15+
16+
if [[ "$DESCRIPTION" == *"untagged"* ]]; then
17+
echo "Unable to determine most recent tag, aborting build"
18+
exit 1
19+
else
20+
if [[ "$DESCRIPTION" != *"g"* ]]; then
21+
# A good description will have the hash prefixed by g, a bad one will be
22+
# just the hash
23+
echo "Unable to determine most recent tag, aborting build"
24+
exit 1
25+
else
26+
echo "$(git tag)"
27+
fi
28+
fi

ci/code_checks.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,8 +263,8 @@ fi
263263
### DOCSTRINGS ###
264264
if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
265265

266-
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA05)' ; echo $MSG
267-
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL04,GL05,GL06,GL07,GL09,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA05
266+
MSG='Validate docstrings (GL03, GL04, GL05, GL06, GL07, GL09, GL10, SS04, SS05, PR03, PR04, PR05, PR10, EX04, RT01, RT04, RT05, SA05)' ; echo $MSG
267+
$BASE_DIR/scripts/validate_docstrings.py --format=azure --errors=GL03,GL04,GL05,GL06,GL07,GL09,GL10,SS04,SS05,PR03,PR04,PR05,PR10,EX04,RT01,RT04,RT05,SA05
268268
RET=$(($RET + $?)) ; echo $MSG "DONE"
269269

270270
fi

ci/deps/azure-36-locale.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ dependencies:
2020
- xlsxwriter=0.9.8
2121
- xlwt=1.2.0
2222
# universal
23-
- pytest>=4.0.2,<5.0.0
24-
- pytest-xdist
23+
- pytest>=5.0.0
24+
- pytest-xdist>=1.29.0
2525
- pytest-mock
2626
- pytest-azurepipelines
2727
- hypothesis>=3.58.0

ci/deps/azure-37-locale.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ dependencies:
2626
- xlsxwriter
2727
- xlwt
2828
# universal
29-
- pytest>=4.0.2
30-
- pytest-xdist
29+
- pytest>=5.0.1
30+
- pytest-xdist>=1.29.0
3131
- pytest-mock
3232
- pytest-azurepipelines
3333
- pip

ci/deps/azure-37-numpydev.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ dependencies:
66
- pytz
77
- Cython>=0.28.2
88
# universal
9-
- pytest>=4.0.2
9+
# pytest < 5 until defaults has pytest-xdist>=1.29.0
10+
- pytest>=4.0.2,<5.0
1011
- pytest-xdist
1112
- pytest-mock
1213
- hypothesis>=3.58.0

ci/deps/azure-macos-35.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ dependencies:
2525
- pip:
2626
- pyreadstat
2727
# universal
28-
- pytest==4.5.0
29-
- pytest-xdist
28+
- pytest>=5.0.1
29+
- pytest-xdist>=1.29.0
3030
- pytest-mock
3131
- hypothesis>=3.58.0
3232
# https://github.com/pandas-dev/pandas/issues/27421

ci/deps/azure-windows-36.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ dependencies:
2323
- xlwt
2424
# universal
2525
- cython>=0.28.2
26-
- pytest>=4.0.2
27-
- pytest-xdist
26+
- pytest>=5.0.1
27+
- pytest-xdist>=1.29.0
2828
- pytest-mock
2929
- pytest-azurepipelines
3030
- hypothesis>=3.58.0

ci/deps/azure-windows-37.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ dependencies:
2626
- xlwt
2727
# universal
2828
- cython>=0.28.2
29-
- pytest>=4.0.2
30-
- pytest-xdist
29+
- pytest>=5.0.0
30+
- pytest-xdist>=1.29.0
3131
- pytest-mock
3232
- pytest-azurepipelines
3333
- hypothesis>=3.58.0

ci/deps/travis-36-cov.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ dependencies:
3939
- xlsxwriter
4040
- xlwt
4141
# universal
42-
- pytest
43-
- pytest-xdist
42+
- pytest>=5.0.1
43+
- pytest-xdist>=1.29.0
4444
- pytest-cov
4545
- pytest-mock
4646
- hypothesis>=3.58.0

ci/deps/travis-36-locale.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ dependencies:
2929
- s3fs=0.0.8
3030
- scipy
3131
- sqlalchemy=1.1.4
32-
- xarray=0.8.2
32+
- xarray=0.10
3333
- xlrd
3434
- xlsxwriter
3535
- xlwt
3636
# universal
37-
- pytest>=4.0.2
38-
- pytest-xdist
37+
- pytest>=5.0.1
38+
- pytest-xdist>=1.29.0
3939
- pytest-mock
4040
- pip
4141
- pip:

ci/deps/travis-36-slow.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ dependencies:
2525
- xlsxwriter
2626
- xlwt
2727
# universal
28-
- pytest>=4.0.2,<5.0.0
29-
- pytest-xdist
28+
- pytest>=5.0.0
29+
- pytest-xdist>=1.29.0
3030
- pytest-mock
3131
- moto
3232
- hypothesis>=3.58.0

ci/deps/travis-37.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ dependencies:
1313
- pyarrow
1414
- pytz
1515
# universal
16-
- pytest>=4.0.2
17-
- pytest-xdist
16+
- pytest>=5.0.0
17+
- pytest-xdist>=1.29.0
1818
- pytest-mock
1919
- hypothesis>=3.58.0
2020
- s3fs

0 commit comments

Comments
 (0)