Skip to content

Commit dae29ef

Browse files
Merge branch 'master' into master
2 parents 1f7c047 + 9285820 commit dae29ef

File tree

193 files changed

+7158
-4636
lines changed

Some content is hidden

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

193 files changed

+7158
-4636
lines changed

.pep8speaks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ pycodestyle:
1111
max-line-length: 79
1212
ignore:
1313
- W503, # line break before binary operator
14+
- W504, # line break after binary operator
1415
- E402, # module level import not at top of file
1516
- E722, # do not use bare except
1617
- E731, # do not assign a lambda expression, use a def
17-
- E741, # ambiguous variable name 'l'
1818
- C406, # Unnecessary list literal - rewrite as a dict literal.
1919
- C408, # Unnecessary dict call - rewrite as a literal.
2020
- C409 # Unnecessary list passed to tuple() - rewrite as a tuple literal.

asv_bench/benchmarks/indexing.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22

33
import numpy as np
44
import pandas.util.testing as tm
5-
from pandas import (Series, DataFrame, MultiIndex, Int64Index, Float64Index,
6-
IntervalIndex, CategoricalIndex,
5+
from pandas import (Series, DataFrame, Panel, MultiIndex, Int64Index,
6+
Float64Index, IntervalIndex, CategoricalIndex,
77
IndexSlice, concat, date_range)
8-
from .pandas_vb_common import Panel
98

109

1110
class NumericSeriesIndexing(object):

asv_bench/benchmarks/join_merge.py

-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
except ImportError:
1212
from pandas import ordered_merge as merge_ordered
1313

14-
from .pandas_vb_common import Panel
15-
1614

1715
class Append(object):
1816

asv_bench/benchmarks/panel_ctor.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
from pandas import DataFrame, Panel, DatetimeIndex, date_range
55

6-
from .pandas_vb_common import Panel
7-
86

97
class DifferentIndexes(object):
108
goal_time = 0.2

asv_bench/benchmarks/panel_methods.py

-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import numpy as np
44
from pandas import Panel
55

6-
from .pandas_vb_common import Panel
7-
86

97
class PanelMethods(object):
108

asv_bench/benchmarks/period.py

+3
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,6 @@ def time_align(self):
119119

120120
def time_intersection(self):
121121
self.index[:750].intersection(self.index[250:])
122+
123+
def time_unique(self):
124+
self.index.unique()

ci/azure-macos-35.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ dependencies:
88
- html5lib
99
- jinja2
1010
- lxml
11-
- matplotlib
11+
- matplotlib=2.2.0
1212
- nomkl
1313
- numexpr
14-
- numpy=1.10.4
14+
- numpy=1.12.0
1515
- openpyxl=2.5.5
1616
- pytables
1717
- python=3.5*

ci/azure-windows-27.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dependencies:
1010
- html5lib
1111
- jinja2=2.8
1212
- lxml
13-
- matplotlib
13+
- matplotlib=2.0.1
1414
- numexpr
1515
- numpy=1.12*
1616
- openpyxl=2.5.5

ci/azure/macos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
maxParallel: 11
1111
matrix:
12-
py35_np_110:
12+
py35_np_120:
1313
ENV_FILE: ci/azure-macos-35.yaml
1414
CONDA_PY: "35"
1515
CONDA_ENV: pandas

ci/azure/windows-py27.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
strategy:
1010
maxParallel: 11
1111
matrix:
12-
py36_np14:
12+
py36_np121:
1313
ENV_FILE: ci/azure-windows-27.yaml
1414
CONDA_PY: "27"
1515
CONDA_ENV: pandas

ci/circle-27-compat.yaml

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6-
- bottleneck=1.0.0
6+
- bottleneck=1.2.0
77
- cython=0.28.2
88
- jinja2=2.8
9-
- numexpr=2.4.4 # we test that we correctly don't use an unsupported numexpr
10-
- numpy=1.9.3
9+
- numexpr=2.6.1
10+
- numpy=1.12.0
1111
- openpyxl=2.5.5
1212
- psycopg2
13-
- pytables=3.2.2
13+
- pytables=3.4.2
1414
- python-dateutil=2.5.0
1515
- python=2.7*
1616
- pytz=2013b
17-
- scipy=0.14.0
17+
- scipy=0.18.1
1818
- sqlalchemy=0.7.8
1919
- xlrd=0.9.2
2020
- xlsxwriter=0.5.2

ci/code_checks.sh

+6-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then
5656
cpplint --quiet --extensions=c,h --headers=h --recursive --filter=-readability/casting,-runtime/int,-build/include_subdir pandas/_libs/src/*.h pandas/_libs/src/parser pandas/_libs/ujson pandas/_libs/tslibs/src/datetime
5757
RET=$(($RET + $?)) ; echo $MSG "DONE"
5858

59+
# Imports - Check formatting using isort see setup.cfg for settings
60+
MSG='Check import format using isort ' ; echo $MSG
61+
isort --recursive --check-only pandas
62+
RET=$(($RET + $?)) ; echo $MSG "DONE"
63+
5964
fi
6065

6166
### PATTERNS ###
@@ -118,7 +123,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
118123

119124
MSG='Doctests frame.py' ; echo $MSG
120125
pytest --doctest-modules -v pandas/core/frame.py \
121-
-k"-axes -combine -itertuples -join -nlargest -nsmallest -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_dict -to_stata"
126+
-k"-axes -combine -itertuples -join -nlargest -nsmallest -nunique -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack -to_stata"
122127
RET=$(($RET + $?)) ; echo $MSG "DONE"
123128

124129
MSG='Doctests series.py' ; echo $MSG

ci/environment-dev.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ dependencies:
88
- flake8
99
- flake8-comprehensions
1010
- hypothesis>=3.58.0
11+
- isort
1112
- moto
1213
- pytest>=3.6
1314
- python-dateutil>=2.5.0

ci/requirements-optional-conda.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
beautifulsoup4>=4.2.1
22
blosc
3-
bottleneck
3+
bottleneck>=1.2.0
44
fastparquet
55
feather-format
66
gcsfs
@@ -9,17 +9,17 @@ ipython>=5.6.0
99
ipykernel
1010
jinja2
1111
lxml
12-
matplotlib
12+
matplotlib>=2.0.0
1313
nbsphinx
14-
numexpr
14+
numexpr>=2.6.1
1515
openpyxl=2.5.5
1616
pyarrow
1717
pymysql
18-
pytables
18+
pytables>=3.4.2
1919
pytest-cov
2020
pytest-xdist
2121
s3fs
22-
scipy
22+
scipy>=0.18.1
2323
seaborn
2424
sqlalchemy
2525
statsmodels

ci/requirements-optional-pip.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Do not modify directly
33
beautifulsoup4>=4.2.1
44
blosc
5-
bottleneck
5+
bottleneck>=1.2.0
66
fastparquet
77
feather-format
88
gcsfs
@@ -11,17 +11,17 @@ ipython>=5.6.0
1111
ipykernel
1212
jinja2
1313
lxml
14-
matplotlib
14+
matplotlib>=2.0.0
1515
nbsphinx
16-
numexpr
16+
numexpr>=2.6.1
1717
openpyxl==2.5.5
1818
pyarrow
1919
pymysql
2020
tables
2121
pytest-cov
2222
pytest-xdist
2323
s3fs
24-
scipy
24+
scipy>=0.18.1
2525
seaborn
2626
sqlalchemy
2727
statsmodels

ci/requirements_dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ NumPy
55
flake8
66
flake8-comprehensions
77
hypothesis>=3.58.0
8+
isort
89
moto
910
pytest>=3.6
1011
python-dateutil>=2.5.0

ci/travis-27-locale.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ channels:
33
- defaults
44
- conda-forge
55
dependencies:
6-
- bottleneck=1.0.0
6+
- bottleneck=1.2.0
77
- cython=0.28.2
88
- lxml
9-
- matplotlib=1.4.3
10-
- numpy=1.9.3
9+
- matplotlib=2.0.0
10+
- numpy=1.12.0
1111
- openpyxl=2.4.0
1212
- python-dateutil
1313
- python-blosc

ci/travis-27.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
- jemalloc=4.5.0.post
1515
- jinja2=2.8
1616
- lxml
17-
- matplotlib
17+
- matplotlib=2.2.2
1818
- mock
1919
- nomkl
2020
- numexpr

ci/travis-36.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ dependencies:
1414
- geopandas
1515
- html5lib
1616
- ipython
17+
- isort
1718
- jinja2
1819
- lxml
1920
- matplotlib

ci/travis-37-numpydev.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ dependencies:
1313
- "git+git://github.com/dateutil/dateutil.git"
1414
- "-f https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"
1515
- "--pre"
16-
- "numpy"
16+
- "numpy<=1.16.0.dev0+20181015190246"
1717
- "scipy"

doc/source/api.rst

+9
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,15 @@ Top-level evaluation
245245

246246
eval
247247

248+
Hashing
249+
~~~~~~~
250+
251+
.. autosummary::
252+
:toctree: generated/
253+
254+
util.hash_array
255+
util.hash_pandas_object
256+
248257
Testing
249258
~~~~~~~
250259

doc/source/cookbook.rst

+33-29
Original file line numberDiff line numberDiff line change
@@ -1228,36 +1228,40 @@ Correlation
12281228

12291229
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.
12301230

1231-
.. ipython:: python
1232-
1233-
def distcorr(x, y):
1234-
n = len(x)
1235-
a = np.zeros(shape=(n, n))
1236-
b = np.zeros(shape=(n, n))
1237-
1238-
for i in range(n):
1239-
for j in range(i + 1, n):
1240-
a[i, j] = abs(x[i] - x[j])
1241-
b[i, j] = abs(y[i] - y[j])
1242-
1243-
a += a.T
1244-
b += b.T
1245-
1246-
a_bar = np.vstack([np.nanmean(a, axis=0)] * n)
1247-
b_bar = np.vstack([np.nanmean(b, axis=0)] * n)
1248-
1249-
A = a - a_bar - a_bar.T + np.full(shape=(n, n), fill_value=a_bar.mean())
1250-
B = b - b_bar - b_bar.T + np.full(shape=(n, n), fill_value=b_bar.mean())
1251-
1252-
cov_ab = np.sqrt(np.nansum(A * B)) / n
1253-
std_a = np.sqrt(np.sqrt(np.nansum(A**2)) / n)
1254-
std_b = np.sqrt(np.sqrt(np.nansum(B**2)) / n)
1255-
1256-
return cov_ab / std_a / std_b
1257-
1258-
df = pd.DataFrame(np.random.normal(size=(100, 3)))
1231+
.. code-block:: python
12591232
1260-
df.corr(method=distcorr)
1233+
>>> def distcorr(x, y):
1234+
... n = len(x)
1235+
... a = np.zeros(shape=(n, n))
1236+
... b = np.zeros(shape=(n, n))
1237+
...
1238+
... for i in range(n):
1239+
... for j in range(i + 1, n):
1240+
... a[i, j] = abs(x[i] - x[j])
1241+
... b[i, j] = abs(y[i] - y[j])
1242+
...
1243+
... a += a.T
1244+
... b += b.T
1245+
...
1246+
... a_bar = np.vstack([np.nanmean(a, axis=0)] * n)
1247+
... b_bar = np.vstack([np.nanmean(b, axis=0)] * n)
1248+
...
1249+
... A = a - a_bar - a_bar.T + np.full(shape=(n, n), fill_value=a_bar.mean())
1250+
... B = b - b_bar - b_bar.T + np.full(shape=(n, n), fill_value=b_bar.mean())
1251+
...
1252+
... cov_ab = np.sqrt(np.nansum(A * B)) / n
1253+
... std_a = np.sqrt(np.sqrt(np.nansum(A**2)) / n)
1254+
... std_b = np.sqrt(np.sqrt(np.nansum(B**2)) / n)
1255+
...
1256+
... return cov_ab / std_a / std_b
1257+
...
1258+
>>> df = pd.DataFrame(np.random.normal(size=(100, 3)))
1259+
...
1260+
>>> df.corr(method=distcorr)
1261+
0 1 2
1262+
0 1.000000 0.171368 0.145302
1263+
1 0.171368 1.000000 0.189919
1264+
2 0.145302 0.189919 1.000000
12611265
12621266
Timedeltas
12631267
----------

doc/source/install.rst

+6-6
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Dependencies
225225
------------
226226

227227
* `setuptools <https://setuptools.readthedocs.io/en/latest/>`__: 24.2.0 or higher
228-
* `NumPy <http://www.numpy.org>`__: 1.9.0 or higher
228+
* `NumPy <http://www.numpy.org>`__: 1.12.0 or higher
229229
* `python-dateutil <https://dateutil.readthedocs.io/en/stable/>`__: 2.5.0 or higher
230230
* `pytz <http://pytz.sourceforge.net/>`__
231231

@@ -236,11 +236,11 @@ Recommended Dependencies
236236

237237
* `numexpr <https://github.com/pydata/numexpr>`__: for accelerating certain numerical operations.
238238
``numexpr`` uses multiple cores as well as smart chunking and caching to achieve large speedups.
239-
If installed, must be Version 2.4.6 or higher.
239+
If installed, must be Version 2.6.1 or higher.
240240

241241
* `bottleneck <https://github.com/kwgoodman/bottleneck>`__: for accelerating certain types of ``nan``
242242
evaluations. ``bottleneck`` uses specialized cython routines to achieve large speedups. If installed,
243-
must be Version 1.0.0 or higher.
243+
must be Version 1.2.0 or higher.
244244

245245
.. note::
246246

@@ -255,9 +255,9 @@ Optional Dependencies
255255

256256
* `Cython <http://www.cython.org>`__: Only necessary to build development
257257
version. Version 0.28.2 or higher.
258-
* `SciPy <http://www.scipy.org>`__: miscellaneous statistical functions, Version 0.14.0 or higher
258+
* `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.
260-
* `PyTables <http://www.pytables.org>`__: necessary for HDF5-based storage. Version 3.0.0 or higher required, Version 3.2.1 or higher highly recommended.
260+
* `PyTables <http://www.pytables.org>`__: necessary for HDF5-based storage, Version 3.4.2 or higher
261261
* `Feather Format <https://github.com/wesm/feather>`__: necessary for feather-based storage, version 0.3.1 or higher.
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:
@@ -266,7 +266,7 @@ Optional Dependencies
266266
* `pymysql <https://github.com/PyMySQL/PyMySQL>`__: for MySQL.
267267
* `SQLite <https://docs.python.org/3/library/sqlite3.html>`__: for SQLite, this is included in Python's standard library by default.
268268

269-
* `matplotlib <http://matplotlib.org/>`__: for plotting, Version 1.4.3 or higher.
269+
* `matplotlib <http://matplotlib.org/>`__: for plotting, Version 2.0.0 or higher.
270270
* For Excel I/O:
271271

272272
* `xlrd/xlwt <http://www.python-excel.org/>`__: Excel reading (xlrd) and writing (xlwt)

0 commit comments

Comments
 (0)