Skip to content

Commit 816f26e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into feature/flake8-rst
Signed-off-by: Fabian Haase <[email protected]>
2 parents c01e22d + 047242b commit 816f26e

File tree

120 files changed

+2083
-1125
lines changed

Some content is hidden

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

120 files changed

+2083
-1125
lines changed

ci/azure-windows-36.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dependencies:
77
- bottleneck
88
- boost-cpp<1.67
99
- fastparquet
10-
- feather-format
1110
- matplotlib
1211
- numexpr
1312
- numpy=1.14*

ci/azure/windows-py27.yml

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

ci/azure/windows.yml

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

ci/circle/run_circle.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ export PATH="$MINICONDA_DIR/bin:$PATH"
55

66
source activate pandas
77

8-
echo "pytest --strict --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas"
9-
pytest --strict --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas
8+
echo "pytest --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas"
9+
pytest --strict --durations=10 --color=no --junitxml=$CIRCLE_TEST_REPORTS/reports/junit.xml $@ pandas

ci/code_checks.sh

+8-4
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,16 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
4747
echo "flake8-rst --version"
4848
flake8-rst --version
4949

50-
MSG='Linting code-blocks in .py docstrings' ; echo $MSG
51-
flake8-rst pandas
50+
MSG='Linting code-blocks in .rst documentation' ; echo $MSG
51+
flake8-rst doc/source --filename=*.rst
5252
RET=$(($RET + $?)) ; echo $MSG "DONE"
5353

54-
MSG='Linting code-blocks in .rst documentation' ; echo $MSG
55-
flake8-rst doc --filename=*.rst
54+
# Check that cython casting is of the form `<type>obj` as opposed to `<type> obj`;
55+
# it doesn't make a difference, but we want to be internally consistent.
56+
# Note: this grep pattern is (intended to be) equivalent to the python
57+
# regex r'(?<![ ->])> '
58+
MSG='Linting .pyx code for spacing conventions in casting' ; echo $MSG
59+
! grep -r -E --include '*.pyx' --include '*.pxi.in' '> ' pandas/_libs | grep -v '[ ->]> '
5660
RET=$(($RET + $?)) ; echo $MSG "DONE"
5761

5862
# readability/casting: Warnings about C casting instead of C++ casting

ci/requirements-optional-conda.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ beautifulsoup4>=4.2.1
22
blosc
33
bottleneck>=1.2.0
44
fastparquet
5-
feather-format
65
gcsfs
76
html5lib
87
ipython>=5.6.0
@@ -13,7 +12,7 @@ matplotlib>=2.0.0
1312
nbsphinx
1413
numexpr>=2.6.1
1514
openpyxl
16-
pyarrow
15+
pyarrow>=0.4.1
1716
pymysql
1817
pytables>=3.4.2
1918
pytest-cov

ci/requirements-optional-pip.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ beautifulsoup4>=4.2.1
44
blosc
55
bottleneck>=1.2.0
66
fastparquet
7-
feather-format
87
gcsfs
98
html5lib
109
ipython>=5.6.0
@@ -15,7 +14,7 @@ matplotlib>=2.0.0
1514
nbsphinx
1615
numexpr>=2.6.1
1716
openpyxl
18-
pyarrow
17+
pyarrow>=0.4.1
1918
pymysql
2019
tables
2120
pytest-cov
@@ -28,4 +27,4 @@ statsmodels
2827
xarray
2928
xlrd
3029
xlsxwriter
31-
xlwt
30+
xlwt

ci/script_multi.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ if [ "$DOC" ]; then
2727
echo "We are not running pytest as this is a doc-build"
2828

2929
elif [ "$COVERAGE" ]; then
30-
echo pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
31-
pytest -s -n 2 -m "not single" --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
30+
echo pytest -s -n 2 -m "not single" --durations=10 --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
31+
pytest -s -n 2 -m "not single" --durations=10 --cov=pandas --cov-report xml:/tmp/cov-multiple.xml --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
3232

3333
elif [ "$SLOW" ]; then
3434
TEST_ARGS="--only-slow --skip-network"
35-
echo pytest -m "not single and slow" -v --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
36-
pytest -m "not single and slow" -v --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
35+
echo pytest -m "not single and slow" -v --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
36+
pytest -m "not single and slow" -v --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
3737

3838
else
39-
echo pytest -n 2 -m "not single" --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
40-
pytest -n 2 -m "not single" --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas # TODO: doctest
39+
echo pytest -n 2 -m "not single" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas
40+
pytest -n 2 -m "not single" --durations=10 --junitxml=test-data-multiple.xml --strict $TEST_ARGS pandas # TODO: doctest
4141

4242
fi
4343

ci/script_single.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ if [ "$DOC" ]; then
2626
echo "We are not running pytest as this is a doc-build"
2727

2828
elif [ "$COVERAGE" ]; then
29-
echo pytest -s -m "single" --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
30-
pytest -s -m "single" --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
29+
echo pytest -s -m "single" --durations=10 --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
30+
pytest -s -m "single" --durations=10 --strict --cov=pandas --cov-report xml:/tmp/cov-single.xml --junitxml=test-data-single.xml $TEST_ARGS pandas
3131
echo pytest -s --strict scripts
3232
pytest -s --strict scripts
3333
else
34-
echo pytest -m "single" --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
35-
pytest -m "single" --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
34+
echo pytest -m "single" --durations=10 --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
35+
pytest -m "single" --durations=10 --junitxml=test-data-single.xml --strict $TEST_ARGS pandas
3636

3737
fi
3838

ci/travis-27.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dependencies:
77
- bottleneck
88
- cython=0.28.2
99
- fastparquet
10-
- feather-format
1110
- gcsfs
1211
- html5lib
1312
- ipython

ci/travis-36-doc.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ dependencies:
88
- bottleneck
99
- cython>=0.28.2
1010
- fastparquet
11-
- feather-format
1211
- html5lib
1312
- hypothesis>=3.58.0
1413
- ipykernel
@@ -24,6 +23,7 @@ dependencies:
2423
- numpy=1.13*
2524
- openpyxl
2625
- pandoc
26+
- pyarrow
2727
- pyqt
2828
- pytables
2929
- python-dateutil

ci/travis-36.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ dependencies:
77
- cython>=0.28.2
88
- dask
99
- fastparquet
10-
- feather-format
1110
- flake8>=3.5
1211
- flake8-comprehensions
1312
- flake8-rst
@@ -24,7 +23,7 @@ dependencies:
2423
- numpy
2524
- openpyxl
2625
- psycopg2
27-
- pyarrow
26+
- pyarrow=0.9.0
2827
- pymysql
2928
- pytables
3029
- python-snappy

ci/travis-37.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ dependencies:
99
- numpy
1010
- python-dateutil
1111
- nomkl
12+
- pyarrow
1213
- pytz
1314
- pytest
1415
- pytest-xdist

doc/source/api.rst

+56
Original file line numberDiff line numberDiff line change
@@ -2104,6 +2104,62 @@ Methods
21042104
Timedelta.to_timedelta64
21052105
Timedelta.total_seconds
21062106

2107+
.. _api.dateoffsets:
2108+
2109+
Date Offsets
2110+
------------
2111+
2112+
.. currentmodule:: pandas.tseries.offsets
2113+
2114+
.. autosummary::
2115+
:toctree: generated/
2116+
2117+
DateOffset
2118+
BusinessDay
2119+
BusinessHour
2120+
CustomBusinessDay
2121+
CustomBusinessHour
2122+
MonthOffset
2123+
MonthEnd
2124+
MonthBegin
2125+
BusinessMonthEnd
2126+
BusinessMonthBegin
2127+
CustomBusinessMonthEnd
2128+
CustomBusinessMonthBegin
2129+
SemiMonthOffset
2130+
SemiMonthEnd
2131+
SemiMonthBegin
2132+
Week
2133+
WeekOfMonth
2134+
LastWeekOfMonth
2135+
QuarterOffset
2136+
BQuarterEnd
2137+
BQuarterBegin
2138+
QuarterEnd
2139+
QuarterBegin
2140+
YearOffset
2141+
BYearEnd
2142+
BYearBegin
2143+
YearEnd
2144+
YearBegin
2145+
FY5253
2146+
FY5253Quarter
2147+
Easter
2148+
Tick
2149+
Day
2150+
Hour
2151+
Minute
2152+
Second
2153+
Milli
2154+
Micro
2155+
Nano
2156+
BDay
2157+
BMonthEnd
2158+
BMonthBegin
2159+
CBMonthEnd
2160+
CBMonthBegin
2161+
CDay
2162+
21072163
.. _api.frequencies:
21082164

21092165
Frequencies

doc/source/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
# JP: added from sphinxdocs
100100
autosummary_generate = False
101101

102-
if any(re.match("\s*api\s*", l) for l in index_rst_lines):
102+
if any(re.match(r"\s*api\s*", l) for l in index_rst_lines):
103103
autosummary_generate = True
104104

105105
# numpydoc
@@ -341,8 +341,8 @@
341341
# file, target name, title, author, documentclass [howto/manual]).
342342
latex_documents = [
343343
('index', 'pandas.tex',
344-
u'pandas: powerful Python data analysis toolkit',
345-
u'Wes McKinney\n\& PyData Development Team', 'manual'),
344+
'pandas: powerful Python data analysis toolkit',
345+
r'Wes McKinney\n\& PyData Development Team', 'manual'),
346346
]
347347

348348
# The name of an image file (relative to this directory) to place at the top of

doc/source/cookbook.rst

+11
Original file line numberDiff line numberDiff line change
@@ -1226,6 +1226,17 @@ Computation
12261226
Correlation
12271227
***********
12281228

1229+
Often it's useful to obtain the lower (or upper) triangular form of a correlation matrix calculated from :func:`DataFrame.corr`. This can be achieved by passing a boolean mask to ``where`` as follows:
1230+
1231+
.. ipython:: python
1232+
1233+
df = pd.DataFrame(np.random.random(size=(100, 5)))
1234+
1235+
corr_mat = df.corr()
1236+
mask = np.tril(np.ones_like(corr_mat, dtype=np.bool), k=-1)
1237+
1238+
corr_mat.where(mask)
1239+
12291240
The `method` argument within `DataFrame.corr` can accept a callable in addition to the named correlation types. Here we compute the `distance correlation <https://en.wikipedia.org/wiki/Distance_correlation>`__ matrix for a `DataFrame` object.
12301241

12311242
.. code-block:: python

doc/source/groupby.rst

+10
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,16 @@ We could naturally group by either the ``A`` or ``B`` columns, or both:
125125
grouped = df.groupby('A')
126126
grouped = df.groupby(['A', 'B'])
127127
128+
.. versionadded:: 0.24
129+
130+
If we also have a MultiIndex on columns ``A`` and ``B``, we can group by all
131+
but the specified columns
132+
133+
.. ipython:: python
134+
135+
df2 = df.set_index(['A', 'B'])
136+
grouped = df2.groupby(level=df2.index.names.difference(['B'])
137+
128138
These will split the DataFrame on its index (rows). We could also split by the
129139
columns:
130140

doc/source/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Optional Dependencies
258258
* `SciPy <http://www.scipy.org>`__: miscellaneous statistical functions, Version 0.18.1 or higher
259259
* `xarray <http://xarray.pydata.org>`__: pandas like handling for > 2 dims, needed for converting Panels to xarray objects. Version 0.7.0 or higher is recommended.
260260
* `PyTables <http://www.pytables.org>`__: necessary for HDF5-based storage, Version 3.4.2 or higher
261-
* `Feather Format <https://github.com/wesm/feather>`__: necessary for feather-based storage, version 0.3.1 or higher.
261+
* `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.4.1): necessary for feather-based storage.
262262
* `Apache Parquet <https://parquet.apache.org/>`__, either `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.4.1) or `fastparquet <https://fastparquet.readthedocs.io/en/latest>`__ (>= 0.0.6) for parquet-based storage. The `snappy <https://pypi.org/project/python-snappy>`__ and `brotli <https://pypi.org/project/brotlipy>`__ are available for compression support.
263263
* `SQLAlchemy <http://www.sqlalchemy.org>`__: for SQL database support. Version 0.8.1 or higher recommended. Besides SQLAlchemy, you also need a database specific driver. You can find an overview of supported drivers for each SQL dialect in the `SQLAlchemy docs <http://docs.sqlalchemy.org/en/latest/dialects/index.html>`__. Some common drivers are:
264264

0 commit comments

Comments
 (0)