Skip to content

Commit 97fc7d4

Browse files
committed
Merge branch 'master' of https://github.com/pandas-dev/pandas into eke_out
2 parents 81e8987 + bdeddb1 commit 97fc7d4

File tree

17 files changed

+412
-445
lines changed

17 files changed

+412
-445
lines changed

.circleci/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,5 @@ jobs:
3434
command: |
3535
export PATH="$MINICONDA_DIR/bin:$PATH"
3636
source activate pandas-dev
37-
echo "pytest --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml --skip-slow --skip-network pandas"
38-
pytest --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml --skip-slow --skip-network pandas
37+
echo "pytest -m "not slow and not network" --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml pandas"
38+
pytest -m "not slow and not network" --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml pandas

.travis.yml

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,28 @@ matrix:
3434
include:
3535
- dist: trusty
3636
env:
37-
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" TEST_ARGS="--skip-slow --skip-network"
37+
- JOB="3.7" ENV_FILE="ci/deps/travis-37.yaml" PATTERN="not slow and not network"
3838

3939
- dist: trusty
4040
env:
41-
- JOB="2.7, locale, slow, old NumPy" ENV_FILE="ci/deps/travis-27-locale.yaml" LOCALE_OVERRIDE="zh_CN.UTF-8" SLOW=true
41+
- JOB="2.7, locale, slow, old NumPy" ENV_FILE="ci/deps/travis-27-locale.yaml" LOCALE_OVERRIDE="zh_CN.UTF-8" PATTERN="slow"
4242
addons:
4343
apt:
4444
packages:
4545
- language-pack-zh-hans
4646
- dist: trusty
4747
env:
48-
- JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" TEST_ARGS="--skip-slow"
48+
- JOB="2.7" ENV_FILE="ci/deps/travis-27.yaml" PATTERN="not slow"
4949
addons:
5050
apt:
5151
packages:
5252
- python-gtk2
5353
- dist: trusty
5454
env:
55-
- JOB="3.6, lint, coverage" ENV_FILE="ci/deps/travis-36.yaml" TEST_ARGS="--skip-slow --skip-network" PANDAS_TESTING_MODE="deprecate" COVERAGE=true LINT=true
55+
- JOB="3.6, lint, coverage" ENV_FILE="ci/deps/travis-36.yaml" PATTERN="not slow and not network" PANDAS_TESTING_MODE="deprecate" COVERAGE=true LINT=true
5656
- dist: trusty
5757
env:
58-
- JOB="3.7, NumPy dev" ENV_FILE="ci/deps/travis-37-numpydev.yaml" TEST_ARGS="--skip-slow --skip-network -W error" PANDAS_TESTING_MODE="deprecate"
58+
- JOB="3.7, NumPy dev" ENV_FILE="ci/deps/travis-37-numpydev.yaml" PATTERN="not slow and not network" TEST_ARGS="-W error" PANDAS_TESTING_MODE="deprecate"
5959
addons:
6060
apt:
6161
packages:
@@ -64,7 +64,7 @@ matrix:
6464
# In allow_failures
6565
- dist: trusty
6666
env:
67-
- JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" SLOW=true
67+
- JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" PATTERN="slow"
6868

6969
# In allow_failures
7070
- dist: trusty
@@ -73,7 +73,7 @@ matrix:
7373
allow_failures:
7474
- dist: trusty
7575
env:
76-
- JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" SLOW=true
76+
- JOB="3.6, slow" ENV_FILE="ci/deps/travis-36-slow.yaml" PATTERN="slow"
7777
- dist: trusty
7878
env:
7979
- JOB="3.6, doc" ENV_FILE="ci/deps/travis-36-doc.yaml" DOC=true
@@ -107,20 +107,16 @@ script:
107107
- echo "script start"
108108
- source activate pandas-dev
109109
- ci/run_build_docs.sh
110-
- ci/script_single.sh
111-
- ci/script_multi.sh
110+
- ci/run_tests.sh
112111
- ci/code_checks.sh
113112

114-
after_success:
115-
- ci/upload_coverage.sh
116-
117113
after_script:
118114
- echo "after_script start"
119115
- source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
120116
- if [ -e test-data-single.xml ]; then
121-
ci/print_skipped.py test-data-single.xml;
117+
ci/print_skipped.py test-data-single.xml;
122118
fi
123119
- if [ -e test-data-multiple.xml ]; then
124-
ci/print_skipped.py test-data-multiple.xml;
120+
ci/print_skipped.py test-data-multiple.xml;
125121
fi
126122
- echo "after_script done"

asv_bench/benchmarks/categoricals.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def setup(self):
4646
self.values_some_nan = list(np.tile(self.categories + [np.nan], N))
4747
self.values_all_nan = [np.nan] * len(self.values)
4848
self.values_all_int8 = np.ones(N, 'int8')
49+
self.categorical = pd.Categorical(self.values, self.categories)
50+
self.series = pd.Series(self.categorical)
4951

5052
def time_regular(self):
5153
pd.Categorical(self.values, self.categories)
@@ -68,6 +70,12 @@ def time_all_nan(self):
6870
def time_from_codes_all_int8(self):
6971
pd.Categorical.from_codes(self.values_all_int8, self.categories)
7072

73+
def time_existing_categorical(self):
74+
pd.Categorical(self.categorical)
75+
76+
def time_existing_series(self):
77+
pd.Categorical(self.series)
78+
7179

7280
class ValueCounts(object):
7381

ci/README.txt

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

ci/azure/linux.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,18 @@ jobs:
1212
py27_np_120:
1313
ENV_FILE: ci/deps/azure-27-compat.yaml
1414
CONDA_PY: "27"
15-
TEST_ARGS: "--skip-slow --skip-network"
15+
PATTERN: "not slow and not network"
1616

1717
py37_locale:
1818
ENV_FILE: ci/deps/azure-37-locale.yaml
1919
CONDA_PY: "37"
20-
TEST_ARGS: "--skip-slow --skip-network"
20+
PATTERN: "not slow and not network"
2121
LOCALE_OVERRIDE: "zh_CN.UTF-8"
2222

2323
py36_locale_slow:
2424
ENV_FILE: ci/deps/azure-36-locale_slow.yaml
2525
CONDA_PY: "36"
26-
TEST_ARGS: "--only-slow --skip-network"
26+
PATTERN: "not slow and not network"
2727
LOCALE_OVERRIDE: "it_IT.UTF-8"
2828

2929
steps:
@@ -43,9 +43,7 @@ jobs:
4343
- script: |
4444
export PATH=$HOME/miniconda3/bin:$PATH
4545
source activate pandas-dev
46-
ci/script_single.sh
47-
ci/script_multi.sh
48-
echo "[Test done]"
46+
ci/run_tests.sh
4947
displayName: 'Test'
5048
- script: |
5149
export PATH=$HOME/miniconda3/bin:$PATH

ci/azure/macos.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
py35_np_120:
1313
ENV_FILE: ci/deps/azure-macos-35.yaml
1414
CONDA_PY: "35"
15-
TEST_ARGS: "--skip-slow --skip-network"
15+
PATTERN: "not slow and not network"
1616

1717
steps:
1818
- script: |
@@ -31,9 +31,7 @@ jobs:
3131
- script: |
3232
export PATH=$HOME/miniconda3/bin:$PATH
3333
source activate pandas-dev
34-
ci/script_single.sh
35-
ci/script_multi.sh
36-
echo "[Test done]"
34+
ci/run_tests.sh
3735
displayName: 'Test'
3836
- script: |
3937
export PATH=$HOME/miniconda3/bin:$PATH

ci/azure/windows-py27.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737
displayName: 'Build'
3838
- script: |
3939
call activate pandas-dev
40-
pytest --junitxml=test-data.xml --skip-slow --skip-network pandas -n 2 -r sxX --strict --durations=10 %*
40+
pytest -m "not slow and not network" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %*
4141
displayName: 'Test'
4242
- task: PublishTestResults@2
4343
inputs:

ci/azure/windows.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
displayName: 'Build'
2929
- script: |
3030
call activate pandas-dev
31-
pytest --junitxml=test-data.xml --skip-slow --skip-network pandas -n 2 -r sxX --strict --durations=10 %*
31+
pytest -m "not slow and not network" --junitxml=test-data.xml pandas -n 2 -r sxX --strict --durations=10 %*
3232
displayName: 'Test'
3333
- task: PublishTestResults@2
3434
inputs:

ci/print_versions.py

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

ci/run_tests.sh

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/bin/bash
2+
3+
if [ "$DOC" ]; then
4+
echo "We are not running pytest as this is a doc-build"
5+
exit 0
6+
fi
7+
8+
# Workaround for pytest-xdist flaky collection order
9+
# https://github.com/pytest-dev/pytest/issues/920
10+
# https://github.com/pytest-dev/pytest/issues/1075
11+
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
12+
13+
if [ -n "$LOCALE_OVERRIDE" ]; then
14+
export LC_ALL="$LOCALE_OVERRIDE"
15+
export LANG="$LOCALE_OVERRIDE"
16+
PANDAS_LOCALE=`python -c 'import pandas; pandas.get_option("display.encoding")'`
17+
if [[ "$LOCALE_OVERIDE" != "$PANDAS_LOCALE" ]]; then
18+
echo "pandas could not detect the locale. System locale: $LOCALE_OVERRIDE, pandas detected: $PANDAS_LOCALE"
19+
# TODO Not really aborting the tests until https://github.com/pandas-dev/pandas/issues/23923 is fixed
20+
# exit 1
21+
fi
22+
fi
23+
if [[ "not network" == *"$PATTERN"* ]]; then
24+
export http_proxy=http://1.2.3.4 https_proxy=http://1.2.3.4;
25+
fi
26+
27+
28+
if [ -n "$PATTERN" ]; then
29+
PATTERN=" and $PATTERN"
30+
fi
31+
32+
for TYPE in single multiple
33+
do
34+
if [ "$COVERAGE" ]; then
35+
COVERAGE_FNAME="/tmp/coc-$TYPE.xml"
36+
COVERAGE="-s --cov=pandas --cov-report=xml:$COVERAGE_FNAME"
37+
fi
38+
39+
TYPE_PATTERN=$TYPE
40+
NUM_JOBS=1
41+
if [[ "$TYPE_PATTERN" == "multiple" ]]; then
42+
TYPE_PATTERN="not single"
43+
NUM_JOBS=2
44+
fi
45+
46+
pytest -m "$TYPE_PATTERN$PATTERN" -n $NUM_JOBS -s --strict --durations=10 --junitxml=test-data-$TYPE.xml $TEST_ARGS $COVERAGE pandas
47+
48+
if [[ "$COVERAGE" && $? == 0 ]]; then
49+
echo "uploading coverage for $TYPE tests"
50+
bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
51+
fi
52+
done

ci/script_multi.sh

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

ci/script_single.sh

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

ci/upload_coverage.sh

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

doc/source/whatsnew/v0.24.0.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1213,6 +1213,7 @@ Performance Improvements
12131213
The speed increase is both when indexing by label (using .loc) and position(.iloc) (:issue:`20395`)
12141214
Slicing a monotonically increasing :class:`CategoricalIndex` itself (i.e. ``ci[1000:2000]``)
12151215
shows similar speed improvements as above (:issue:`21659`)
1216+
- Improved performance of :meth:`CategoricalIndex.equals` when comparing to another :class:`CategoricalIndex` (:issue:`24023`)
12161217
- Improved performance of :func:`Series.describe` in case of numeric dtpyes (:issue:`21274`)
12171218
- Improved performance of :func:`pandas.core.groupby.GroupBy.rank` when dealing with tied rankings (:issue:`21237`)
12181219
- Improved performance of :func:`DataFrame.set_index` with columns consisting of :class:`Period` objects (:issue:`21582`, :issue:`21606`)
@@ -1228,7 +1229,7 @@ Performance Improvements
12281229
- Improved performance of :func:`pd.concat` for `Series` objects (:issue:`23404`)
12291230
- Improved performance of :meth:`DatetimeIndex.normalize` and :meth:`Timestamp.normalize` for timezone naive or UTC datetimes (:issue:`23634`)
12301231
- Improved performance of :meth:`DatetimeIndex.tz_localize` and various ``DatetimeIndex`` attributes with dateutil UTC timezone (:issue:`23772`)
1231-
1232+
- Improved performance of :class:`Categorical` constructor for `Series` objects (:issue:`23814`)
12321233

12331234
.. _whatsnew_0240.docs:
12341235

0 commit comments

Comments
 (0)