Skip to content

Commit 4f53e80

Browse files
committed
Merge master
2 parents aa4722c + a1fee91 commit 4f53e80

File tree

475 files changed

+6446
-7713
lines changed

Some content is hidden

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

475 files changed

+6446
-7713
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ dist
6161
.coverage
6262
coverage.xml
6363
coverage_html_report
64+
.mypy_cache
6465
*.pytest_cache
6566
# hypothesis test database
6667
.hypothesis/

.travis.yml

+2-7
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ matrix:
4141

4242
- dist: trusty
4343
env:
44-
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="((not slow and not network) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true
44+
- JOB="3.6, coverage" ENV_FILE="ci/deps/travis-36-cov.yaml" PATTERN="((not slow and not network) or (single and db))" PANDAS_TESTING_MODE="deprecate" COVERAGE=true
4545

4646
# In allow_failures
4747
- dist: trusty
@@ -82,15 +82,10 @@ before_install:
8282
install:
8383
- echo "install start"
8484
- ci/prep_cython_cache.sh
85-
- ci/install_travis.sh
85+
- ci/setup_env.sh
8686
- ci/submit_cython_cache.sh
8787
- echo "install done"
8888

89-
before_script:
90-
- ci/install_db_travis.sh
91-
- export DISPLAY=":99.0"
92-
- ci/before_script_travis.sh
93-
9489
script:
9590
- echo "script start"
9691
- source activate pandas-dev

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ pip install pandas
164164
```
165165

166166
## Dependencies
167-
- [NumPy](https://www.numpy.org): 1.12.0 or higher
167+
- [NumPy](https://www.numpy.org): 1.13.3 or higher
168168
- [python-dateutil](https://labix.org/python-dateutil): 2.5.0 or higher
169169
- [pytz](https://pythonhosted.org/pytz): 2015.4 or higher
170170

asv_bench/benchmarks/io/csv.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import numpy as np
55
import pandas.util.testing as tm
66
from pandas import DataFrame, Categorical, date_range, read_csv
7-
from pandas.compat import cStringIO as StringIO
7+
from io import StringIO
88

99
from ..pandas_vb_common import BaseIO
1010

asv_bench/benchmarks/io/excel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
from io import BytesIO
12
import numpy as np
23
from pandas import DataFrame, date_range, ExcelWriter, read_excel
3-
from pandas.compat import BytesIO
44
import pandas.util.testing as tm
55

66

asv_bench/benchmarks/rolling.py

+16
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,20 @@ def time_quantile(self, constructor, window, dtype, percentile,
113113
self.roll.quantile(percentile, interpolation=interpolation)
114114

115115

116+
class PeakMemFixed(object):
117+
118+
def setup(self):
119+
N = 10
120+
arr = 100 * np.random.random(N)
121+
self.roll = pd.Series(arr).rolling(10)
122+
123+
def peakmem_fixed(self):
124+
# GH 25926
125+
# This is to detect memory leaks in rolling operations.
126+
# To save time this is only ran on one method.
127+
# 6000 iterations is enough for most types of leaks to be detected
128+
for x in range(6000):
129+
self.roll.max()
130+
131+
116132
from .pandas_vb_common import setup # noqa: F401

azure-pipelines.yml

+9-10
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,8 @@ jobs:
3939
- script: |
4040
export PATH=$HOME/miniconda3/bin:$PATH
4141
sudo apt-get install -y libc6-dev-i386
42-
ci/incremental/install_miniconda.sh
43-
ci/incremental/setup_conda_environment.sh
44-
displayName: 'Set up environment'
42+
ci/setup_env.sh
43+
displayName: 'Setup environment and build pandas'
4544
condition: true
4645
4746
# Do not require pandas
@@ -59,13 +58,6 @@ jobs:
5958
displayName: 'Dependencies consistency'
6059
condition: true
6160
62-
- script: |
63-
export PATH=$HOME/miniconda3/bin:$PATH
64-
source activate pandas-dev
65-
ci/incremental/build.sh
66-
displayName: 'Build'
67-
condition: true
68-
6961
# Require pandas
7062
- script: |
7163
export PATH=$HOME/miniconda3/bin:$PATH
@@ -88,6 +80,13 @@ jobs:
8880
displayName: 'Docstring validation'
8981
condition: true
9082
83+
- script: |
84+
export PATH=$HOME/miniconda3/bin:$PATH
85+
source activate pandas-dev
86+
ci/code_checks.sh typing
87+
displayName: 'Typing validation'
88+
condition: true
89+
9190
- script: |
9291
export PATH=$HOME/miniconda3/bin:$PATH
9392
source activate pandas-dev

ci/azure/posix.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,18 @@ jobs:
1515
PATTERN: "not slow and not network"
1616

1717
${{ if eq(parameters.name, 'Linux') }}:
18+
py35_compat:
19+
ENV_FILE: ci/deps/azure-35-compat.yaml
20+
CONDA_PY: "35"
21+
PATTERN: "not slow and not network"
22+
23+
py36_locale_slow_old_np:
24+
ENV_FILE: ci/deps/azure-36-locale.yaml
25+
CONDA_PY: "36"
26+
PATTERN: "slow"
27+
LOCALE_OVERRIDE: "zh_CN.UTF-8"
28+
EXTRA_APT: "language-pack-zh-hans"
29+
1830
py36_locale_slow:
1931
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
2032
CONDA_PY: "36"
@@ -38,17 +50,9 @@ jobs:
3850
steps:
3951
- script: |
4052
if [ "$(uname)" == "Linux" ]; then sudo apt-get install -y libc6-dev-i386 $EXTRA_APT; fi
41-
echo "Installing Miniconda"
42-
ci/incremental/install_miniconda.sh
43-
export PATH=$HOME/miniconda3/bin:$PATH
44-
echo "Setting up Conda environment"
45-
ci/incremental/setup_conda_environment.sh
46-
displayName: 'Before Install'
47-
- script: |
48-
export PATH=$HOME/miniconda3/bin:$PATH
49-
source activate pandas-dev
50-
ci/incremental/build.sh
51-
displayName: 'Build'
53+
echo "Creating Environment"
54+
ci/setup_env.sh
55+
displayName: 'Setup environment and build pandas'
5256
- script: |
5357
export PATH=$HOME/miniconda3/bin:$PATH
5458
source activate pandas-dev

ci/azure/windows.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ jobs:
88
vmImage: ${{ parameters.vmImage }}
99
strategy:
1010
matrix:
11-
py36_np14:
11+
py36_np15:
1212
ENV_FILE: ci/deps/azure-windows-36.yaml
1313
CONDA_PY: "36"
1414

15+
py37_np141:
16+
ENV_FILE: ci/deps/azure-windows-37.yaml
17+
CONDA_PY: "37"
18+
1519
steps:
1620
- task: CondaEnvironment@1
1721
inputs:

ci/before_script_travis.sh

-11
This file was deleted.

ci/code_checks.sh

+23-4
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
# $ ./ci/code_checks.sh doctests # run doctests
1717
# $ ./ci/code_checks.sh docstrings # validate docstring errors
1818
# $ ./ci/code_checks.sh dependencies # check that dependencies are consistent
19+
# $ ./ci/code_checks.sh typing # run static type analysis
1920

20-
[[ -z "$1" || "$1" == "lint" || "$1" == "patterns" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "dependencies" ]] || \
21-
{ echo "Unknown command $1. Usage: $0 [lint|patterns|code|doctests|docstrings|dependencies]"; exit 9999; }
21+
[[ -z "$1" || "$1" == "lint" || "$1" == "patterns" || "$1" == "code" || "$1" == "doctests" || "$1" == "docstrings" || "$1" == "dependencies" || "$1" == "typing" ]] || \
22+
{ echo "Unknown command $1. Usage: $0 [lint|patterns|code|doctests|docstrings|dependencies|typing]"; exit 9999; }
2223

2324
BASE_DIR="$(dirname $0)/.."
2425
RET=0
@@ -110,15 +111,21 @@ fi
110111
if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
111112

112113
# Check for imports from pandas.core.common instead of `import pandas.core.common as com`
114+
# Check for imports from collections.abc instead of `from collections import abc`
113115
MSG='Check for non-standard imports' ; echo $MSG
114116
invgrep -R --include="*.py*" -E "from pandas.core.common import " pandas
117+
invgrep -R --include="*.py*" -E "from collections.abc import " pandas
115118
# invgrep -R --include="*.py*" -E "from numpy import nan " pandas # GH#24822 not yet implemented since the offending imports have not all been removed
116119
RET=$(($RET + $?)) ; echo $MSG "DONE"
117120

118121
MSG='Check for pytest warns' ; echo $MSG
119122
invgrep -r -E --include '*.py' 'pytest\.warns' pandas/tests/
120123
RET=$(($RET + $?)) ; echo $MSG "DONE"
121124

125+
MSG='Check for pytest raises without context' ; echo $MSG
126+
invgrep -r -E --include '*.py' "[[:space:]] pytest.raises" pandas/tests/
127+
RET=$(($RET + $?)) ; echo $MSG "DONE"
128+
122129
# Check for the following code in testing: `np.testing` and `np.array_equal`
123130
MSG='Check for invalid testing' ; echo $MSG
124131
invgrep -r -E --include '*.py' --exclude testing.py '(numpy|np)(\.testing|\.array_equal)' pandas/tests/
@@ -175,9 +182,9 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
175182
set -o pipefail
176183
if [[ "$AZURE" == "true" ]]; then
177184
# we exclude all c/cpp files as the c/cpp files of pandas code base are tested when Linting .c and .h files
178-
! grep -n '--exclude=*.'{svg,c,cpp,html} -RI "\s$" * | awk -F ":" '{print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Tailing whitespaces found: " $3}'
185+
! grep -n '--exclude=*.'{svg,c,cpp,html} --exclude-dir=env -RI "\s$" * | awk -F ":" '{print "##vso[task.logissue type=error;sourcepath=" $1 ";linenumber=" $2 ";] Tailing whitespaces found: " $3}'
179186
else
180-
! grep -n '--exclude=*.'{svg,c,cpp,html} -RI "\s$" * | awk -F ":" '{print $1 ":" $2 ":Tailing whitespaces found: " $3}'
187+
! grep -n '--exclude=*.'{svg,c,cpp,html} --exclude-dir=env -RI "\s$" * | awk -F ":" '{print $1 ":" $2 ":Tailing whitespaces found: " $3}'
181188
fi
182189
RET=$(($RET + $?)) ; echo $MSG "DONE"
183190
fi
@@ -256,4 +263,16 @@ if [[ -z "$CHECK" || "$CHECK" == "dependencies" ]]; then
256263

257264
fi
258265

266+
### TYPING ###
267+
if [[ -z "$CHECK" || "$CHECK" == "typing" ]]; then
268+
269+
echo "mypy --version"
270+
mypy --version
271+
272+
MSG='Performing static analysis using mypy' ; echo $MSG
273+
mypy pandas
274+
RET=$(($RET + $?)) ; echo $MSG "DONE"
275+
fi
276+
277+
259278
exit $RET

ci/deps/azure-35-compat.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: pandas-dev
2+
channels:
3+
- defaults
4+
- conda-forge
5+
dependencies:
6+
- beautifulsoup4=4.4.1
7+
- bottleneck=1.2.1
8+
- jinja2=2.8
9+
- numexpr=2.6.2
10+
- numpy=1.13.3
11+
- openpyxl=2.4.0
12+
- pytables=3.4.2
13+
- python-dateutil=2.5.0
14+
- python=3.5.*
15+
- pytz=2015.4
16+
- scipy=0.19.0
17+
- xlrd=1.0.0
18+
- xlsxwriter=0.7.7
19+
- xlwt=1.0.0
20+
# universal
21+
- cython=0.28.2
22+
- hypothesis>=3.58.0
23+
- pytest-xdist
24+
- pytest-mock
25+
- isort
26+
- pip
27+
- pip:
28+
# for python 3.5, pytest>=4.0.2 is not available in conda
29+
- pytest>=4.0.2
30+
- html5lib==1.0b2

ci/deps/azure-36-locale.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: pandas-dev
2+
channels:
3+
- defaults
4+
- conda-forge
5+
dependencies:
6+
- beautifulsoup4==4.5.1
7+
- bottleneck=1.2.*
8+
- cython=0.28.2
9+
- lxml
10+
- matplotlib=2.2.2
11+
- numpy=1.14.*
12+
- openpyxl=2.4.0
13+
- python-dateutil
14+
- python-blosc
15+
- python=3.6.*
16+
- pytz=2016.10
17+
- scipy
18+
- sqlalchemy=1.1.4
19+
- xlrd=1.0.0
20+
- xlsxwriter=0.9.4
21+
- xlwt=1.2.0
22+
# universal
23+
- pytest>=4.0.2
24+
- pytest-xdist
25+
- pytest-mock
26+
- hypothesis>=3.58.0
27+
- isort
28+
- pip
29+
- pip:
30+
- html5lib==1.0b2

ci/deps/azure-36-locale_slow.yaml

+4-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ dependencies:
1010
- ipython
1111
- jinja2
1212
- lxml
13-
- matplotlib
13+
- matplotlib=3.0.*
1414
- nomkl
1515
- numexpr
16-
- numpy
16+
- numpy=1.15.*
1717
- openpyxl
1818
- pytables
1919
- python-dateutil
20-
- python=3.6*
20+
- python=3.6.*
2121
- pytz
2222
- s3fs
2323
- scipy
@@ -31,5 +31,6 @@ dependencies:
3131
- pytest-mock
3232
- moto
3333
- isort
34+
- pip
3435
- pip:
3536
- hypothesis>=3.58.0

ci/deps/azure-37-locale.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ dependencies:
1616
- openpyxl
1717
- pytables
1818
- python-dateutil
19-
- python=3.7*
19+
- python=3.7.*
2020
- pytz
2121
- s3fs
2222
- scipy
@@ -29,6 +29,7 @@ dependencies:
2929
- pytest-xdist
3030
- pytest-mock
3131
- isort
32+
- pip
3233
- pip:
3334
- hypothesis>=3.58.0
3435
- moto # latest moto in conda-forge fails with 3.7, move to conda dependencies when this is fixed

ci/deps/azure-37-numpydev.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: pandas-dev
22
channels:
33
- defaults
44
dependencies:
5-
- python=3.7*
5+
- python=3.7.*
66
- pytz
77
- Cython>=0.28.2
88
# universal
@@ -11,6 +11,7 @@ dependencies:
1111
- pytest-mock
1212
- hypothesis>=3.58.0
1313
- isort
14+
- pip
1415
- pip:
1516
- "git+git://github.com/dateutil/dateutil.git"
1617
- "-f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"

ci/deps/azure-macos-35.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ dependencies:
88
- html5lib
99
- jinja2
1010
- lxml
11-
- matplotlib=2.2.0
11+
- matplotlib=2.2.3
1212
- nomkl
1313
- numexpr
14-
- numpy=1.12.0
15-
- openpyxl=2.5.5
14+
- numpy=1.13.3
15+
- openpyxl
1616
- pyarrow
1717
- pytables
18-
- python=3.5*
18+
- python=3.5.*
1919
- pytz
2020
- xarray
2121
- xlrd

0 commit comments

Comments
 (0)