Skip to content

Commit 99dc246

Browse files
committed
merge for update
2 parents 55d1cf7 + 9cfb8b5 commit 99dc246

File tree

190 files changed

+6760
-4633
lines changed

Some content is hidden

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

190 files changed

+6760
-4633
lines changed

asv_bench/benchmarks/frame_methods.py

+11
Original file line numberDiff line numberDiff line change
@@ -609,4 +609,15 @@ def time_dataframe_describe(self):
609609
self.df.describe()
610610

611611

612+
class SelectDtypes:
613+
params = [100, 1000]
614+
param_names = ["n"]
615+
616+
def setup(self, n):
617+
self.df = DataFrame(np.random.randn(10, n))
618+
619+
def time_select_dtypes(self, n):
620+
self.df.select_dtypes(include="int")
621+
622+
612623
from .pandas_vb_common import setup # noqa: F401 isort:skip

asv_bench/benchmarks/rolling.py

+19
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,25 @@ def peakmem_rolling(self, constructor, window, dtype, method):
2525
getattr(self.roll, method)()
2626

2727

28+
class Apply:
29+
params = (
30+
["DataFrame", "Series"],
31+
[10, 1000],
32+
["int", "float"],
33+
[sum, np.sum, lambda x: np.sum(x) + 5],
34+
[True, False],
35+
)
36+
param_names = ["contructor", "window", "dtype", "function", "raw"]
37+
38+
def setup(self, constructor, window, dtype, function, raw):
39+
N = 10 ** 5
40+
arr = (100 * np.random.random(N)).astype(dtype)
41+
self.roll = getattr(pd, constructor)(arr).rolling(window)
42+
43+
def time_rolling(self, constructor, window, dtype, function, raw):
44+
self.roll.apply(function, raw=raw)
45+
46+
2847
class ExpandingMethods:
2948

3049
params = (

azure-pipelines.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ jobs:
121121
122122
- script: |
123123
source activate pandas-dev
124-
python web/pandas_web.py web/pandas
124+
python web/pandas_web.py web/pandas --target-path=web/build
125125
displayName: 'Build website'
126126
127127
- script: |
@@ -171,7 +171,7 @@ jobs:
171171
eq(variables['Build.SourceBranch'], 'refs/heads/master'))
172172
173173
- script: |
174-
cd doc/build/html
174+
cd to_deploy
175175
git remote add origin [email protected]:pandas-dev/pandas-dev.github.io.git
176176
git push -f origin master
177177
displayName: 'Publish web and docs to GitHub pages'

ci/azure/posix.yml

+7
Original file line numberDiff line numberDiff line change
@@ -60,15 +60,21 @@ jobs:
6060
echo "Creating Environment"
6161
ci/setup_env.sh
6262
displayName: 'Setup environment and build pandas'
63+
6364
- script: |
6465
source activate pandas-dev
6566
ci/run_tests.sh
6667
displayName: 'Test'
68+
6769
- script: source activate pandas-dev && pushd /tmp && python -c "import pandas; pandas.show_versions();" && popd
70+
displayName: 'Build versions'
71+
6872
- task: PublishTestResults@2
6973
inputs:
7074
testResultsFiles: 'test-data-*.xml'
7175
testRunTitle: ${{ format('{0}-$(CONDA_PY)', parameters.name) }}
76+
displayName: 'Publish test results'
77+
7278
- powershell: |
7379
$junitXml = "test-data-single.xml"
7480
$(Get-Content $junitXml | Out-String) -match 'failures="(.*?)"'
@@ -94,6 +100,7 @@ jobs:
94100
Write-Error "$($matches[1]) tests failed"
95101
}
96102
displayName: 'Check for test failures'
103+
97104
- script: |
98105
source activate pandas-dev
99106
python ci/print_skipped.py

ci/code_checks.sh

+9-1
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
125125
# invgrep -R --include="*.py*" -E "from numpy import nan " pandas # GH#24822 not yet implemented since the offending imports have not all been removed
126126
RET=$(($RET + $?)) ; echo $MSG "DONE"
127127

128+
MSG='Check for use of exec' ; echo $MSG
129+
invgrep -R --include="*.py*" -E "[^a-zA-Z0-9_]exec\(" pandas
130+
RET=$(($RET + $?)) ; echo $MSG "DONE"
131+
128132
MSG='Check for pytest warns' ; echo $MSG
129133
invgrep -r -E --include '*.py' 'pytest\.warns' pandas/tests/
130134
RET=$(($RET + $?)) ; echo $MSG "DONE"
@@ -184,7 +188,7 @@ if [[ -z "$CHECK" || "$CHECK" == "patterns" ]]; then
184188
invgrep -R --include="*.rst" ".. ipython ::" doc/source
185189
RET=$(($RET + $?)) ; echo $MSG "DONE"
186190

187-
MSG='Check that no file in the repo contains tailing whitespaces' ; echo $MSG
191+
MSG='Check that no file in the repo contains trailing whitespaces' ; echo $MSG
188192
set -o pipefail
189193
if [[ "$AZURE" == "true" ]]; then
190194
# we exclude all c/cpp files as the c/cpp files of pandas code base are tested when Linting .c and .h files
@@ -262,6 +266,10 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
262266
-k"-from_arrays -from_breaks -from_intervals -from_tuples -set_closed -to_tuples -interval_range"
263267
RET=$(($RET + $?)) ; echo $MSG "DONE"
264268

269+
MSG='Doctests arrays/string_.py' ; echo $MSG
270+
pytest -q --doctest-modules pandas/core/arrays/string_.py
271+
RET=$(($RET + $?)) ; echo $MSG "DONE"
272+
265273
fi
266274

267275
### DOCSTRINGS ###

ci/deps/travis-36-cov.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ dependencies:
2929
- python-snappy
3030
- python=3.6.*
3131
- pytz
32-
- s3fs
32+
- s3fs<0.3
3333
- scikit-learn
3434
- scipy
3535
- sqlalchemy

ci/deps/travis-36-slow.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
- python-dateutil
1919
- python=3.6.*
2020
- pytz
21-
- s3fs
21+
- s3fs<0.3
2222
- scipy
2323
- sqlalchemy
2424
- xlrd

ci/deps/travis-37.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ dependencies:
1717
- pytest-xdist>=1.29.0
1818
- pytest-mock
1919
- hypothesis>=3.58.0
20-
- s3fs
20+
- s3fs<0.3
2121
- pip
2222
- pyreadstat
2323
- pip:

ci/print_skipped.py

+23-35
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,40 @@
11
#!/usr/bin/env python
2-
3-
import math
42
import os
5-
import sys
63
import xml.etree.ElementTree as et
74

85

9-
def parse_results(filename):
6+
def main(filename):
7+
if not os.path.isfile(filename):
8+
return
9+
1010
tree = et.parse(filename)
1111
root = tree.getroot()
12-
skipped = []
13-
1412
current_class = ""
15-
i = 1
16-
assert i - 1 == len(skipped)
1713
for el in root.findall("testcase"):
1814
cn = el.attrib["classname"]
1915
for sk in el.findall("skipped"):
2016
old_class = current_class
2117
current_class = cn
22-
name = "{classname}.{name}".format(
23-
classname=current_class, name=el.attrib["name"]
24-
)
25-
msg = sk.attrib["message"]
26-
out = ""
2718
if old_class != current_class:
28-
ndigits = int(math.log(i, 10) + 1)
29-
30-
# 4 for : + space + # + space
31-
out += "-" * (len(name + msg) + 4 + ndigits) + "\n"
32-
out += "#{i} {name}: {msg}".format(i=i, name=name, msg=msg)
33-
skipped.append(out)
34-
i += 1
35-
assert i - 1 == len(skipped)
36-
assert i - 1 == len(skipped)
37-
# assert len(skipped) == int(root.attrib['skip'])
38-
return "\n".join(skipped)
39-
40-
41-
def main():
42-
test_files = ["test-data-single.xml", "test-data-multiple.xml", "test-data.xml"]
43-
44-
print("SKIPPED TESTS:")
45-
for fn in test_files:
46-
if os.path.isfile(fn):
47-
print(parse_results(fn))
48-
return 0
19+
yield None
20+
yield {
21+
"class_name": current_class,
22+
"test_name": el.attrib["name"],
23+
"message": sk.attrib["message"],
24+
}
4925

5026

5127
if __name__ == "__main__":
52-
sys.exit(main())
28+
print("SKIPPED TESTS:")
29+
i = 1
30+
for file_type in ("-single", "-multiple", ""):
31+
for test_data in main("test-data{}.xml".format(file_type)):
32+
if test_data is None:
33+
print("-" * 80)
34+
else:
35+
print(
36+
"#{i} {class_name}.{test_name}: {message}".format(
37+
**dict(test_data, i=i)
38+
)
39+
)
40+
i += 1

ci/run_tests.sh

+8-16
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
#!/bin/bash
1+
#!/bin/bash -e
22

3-
set -e
4-
5-
if [ "$DOC" ]; then
6-
echo "We are not running pytest as this is a doc-build"
7-
exit 0
8-
fi
9-
10-
# Workaround for pytest-xdist flaky collection order
3+
# Workaround for pytest-xdist (it collects different tests in the workers if PYTHONHASHSEED is not set)
114
# https://github.com/pytest-dev/pytest/issues/920
125
# https://github.com/pytest-dev/pytest/issues/1075
136
export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 4294967295))')
@@ -16,7 +9,7 @@ if [ -n "$LOCALE_OVERRIDE" ]; then
169
export LC_ALL="$LOCALE_OVERRIDE"
1710
export LANG="$LOCALE_OVERRIDE"
1811
PANDAS_LOCALE=`python -c 'import pandas; pandas.get_option("display.encoding")'`
19-
if [[ "$LOCALE_OVERIDE" != "$PANDAS_LOCALE" ]]; then
12+
if [[ "$LOCALE_OVERRIDE" != "$PANDAS_LOCALE" ]]; then
2013
echo "pandas could not detect the locale. System locale: $LOCALE_OVERRIDE, pandas detected: $PANDAS_LOCALE"
2114
# TODO Not really aborting the tests until https://github.com/pandas-dev/pandas/issues/23923 is fixed
2215
# exit 1
@@ -50,10 +43,9 @@ do
5043
# if no tests are found (the case of "single and slow"), pytest exits with code 5, and would make the script fail, if not for the below code
5144
sh -c "$PYTEST_CMD; ret=\$?; [ \$ret = 5 ] && exit 0 || exit \$ret"
5245

53-
# 2019-08-21 disabling because this is hitting HTTP 400 errors GH#27602
54-
# if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
55-
# echo "uploading coverage for $TYPE tests"
56-
# echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
57-
# bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
58-
# fi
46+
if [[ "$COVERAGE" && $? == 0 && "$TRAVIS_BRANCH" == "master" ]]; then
47+
echo "uploading coverage for $TYPE tests"
48+
echo "bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME"
49+
bash <(curl -s https://codecov.io/bash) -Z -c -F $TYPE -f $COVERAGE_FNAME
50+
fi
5951
done

doc/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
data/
2+
timeseries.csv
3+
timeseries.parquet
4+
timeseries_wide.parquet

doc/redirects.csv

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ whatsnew,whatsnew/index
66
release,whatsnew/index
77

88
# getting started
9+
install,getting_started/install
910
10min,getting_started/10min
1011
basics,getting_started/basics
1112
comparison_with_r,getting_started/comparison/comparison_with_r
@@ -1577,3 +1578,6 @@ generated/pandas.unique,../reference/api/pandas.unique
15771578
generated/pandas.util.hash_array,../reference/api/pandas.util.hash_array
15781579
generated/pandas.util.hash_pandas_object,../reference/api/pandas.util.hash_pandas_object
15791580
generated/pandas.wide_to_long,../reference/api/pandas.wide_to_long
1581+
1582+
# Cached searches
1583+
reference/api/pandas.DataFrame.from_csv,pandas.read_csv

doc/source/conf.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191

192192
# The theme to use for HTML and HTML Help pages. Major themes that come with
193193
# Sphinx are currently 'default' and 'sphinxdoc'.
194-
html_theme = "nature_with_gtoc"
194+
html_theme = "pandas_sphinx_theme"
195195

196196
# The style sheet to use for HTML and HTML Help pages. A file of that name
197197
# must exist either in Sphinx' static/ path, or in one of the custom paths
@@ -204,7 +204,7 @@
204204
# html_theme_options = {}
205205

206206
# Add any paths that contain custom themes here, relative to this directory.
207-
html_theme_path = ["themes"]
207+
# html_theme_path = ["themes"]
208208

209209
# The name for this set of Sphinx documents. If None, it defaults to
210210
# "<project> v<release> documentation".

doc/source/development/contributing.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ the expected correct result::
952952
Transitioning to ``pytest``
953953
~~~~~~~~~~~~~~~~~~~~~~~~~~~
954954

955-
*pandas* existing test structure is *mostly* classed based, meaning that you will typically find tests wrapped in a class.
955+
*pandas* existing test structure is *mostly* class-based, meaning that you will typically find tests wrapped in a class.
956956

957957
.. code-block:: python
958958

doc/source/development/index.rst

+1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ Development
1616
internals
1717
extending
1818
developer
19+
policies
1920
roadmap

doc/source/development/policies.rst

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. _develop.policies:
2+
3+
********
4+
Policies
5+
********
6+
7+
.. _policies.version:
8+
9+
Version Policy
10+
~~~~~~~~~~~~~~
11+
12+
.. versionchanged:: 1.0.0
13+
14+
Pandas uses a loose variant of semantic versioning (`SemVer`_) to govern
15+
deprecations, API compatibility, and version numbering.
16+
17+
A pandas release number is made up of ``MAJOR.MINOR.PATCH``.
18+
19+
API breaking changes should only occur in **major** releases. Theses changes
20+
will be documented, with clear guidance on what is changing, why it's changing,
21+
and how to migrate existing code to the new behavior.
22+
23+
Whenever possible, a deprecation path will be provided rather than an outright
24+
breaking change.
25+
26+
Pandas will introduce deprecations in **minor** releases. These deprecations
27+
will preserve the existing behavior while emitting a warning that provide
28+
guidance on:
29+
30+
* How to achieve similar behavior if an alternative is available
31+
* The pandas version in which the deprecation will be enforced.
32+
33+
We will not introduce new deprecations in patch releases.
34+
35+
Deprecations will only be enforced in **major** releases. For example, if a
36+
behavior is deprecated in pandas 1.2.0, it will continue to work, with a
37+
warning, for all releases in the 1.x series. The behavior will change and the
38+
deprecation removed in the next next major release (2.0.0).
39+
40+
.. note::
41+
42+
Pandas will sometimes make *behavior changing* bug fixes, as part of
43+
minor or patch releases. Whether or not a change is a bug fix or an
44+
API-breaking change is a judgement call. We'll do our best, and we
45+
invite you to participate in development discussion on the issue
46+
tracker or mailing list.
47+
48+
These policies do not apply to features marked as **experimental** in the documentation.
49+
Pandas may change the behavior of experimental features at any time.
50+
51+
Python Support
52+
~~~~~~~~~~~~~~
53+
54+
Pandas will only drop support for specific Python versions (e.g. 3.5.x, 3.6.x) in
55+
pandas **major** releases.
56+
57+
.. _SemVer: https://semver.org

doc/source/ecosystem.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
.. _ecosystem:
24

35
{{ header }}

0 commit comments

Comments
 (0)