Skip to content

Commit b977615

Browse files
committed
Merge remote-tracking branch 'pandas-dev/master'
2 parents 09360d8 + 9da0e0b commit b977615

File tree

251 files changed

+1049
-893
lines changed

Some content is hidden

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

251 files changed

+1049
-893
lines changed

Makefile

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
tseries: pandas/lib.pyx pandas/tslib.pyx pandas/hashtable.pyx
1+
tseries: pandas/_libs/lib.pyx pandas/_libs/tslib.pyx pandas/_libs/hashtable.pyx
22
python setup.py build_ext --inplace
33

44
.PHONY : develop build clean clean_pyc tseries doc
@@ -9,9 +9,6 @@ clean:
99
clean_pyc:
1010
-find . -name '*.py[co]' -exec rm {} \;
1111

12-
sparse: pandas/src/sparse.pyx
13-
python setup.py build_ext --inplace
14-
1512
build: clean_pyc
1613
python setup.py build_ext --inplace
1714

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@
5454
<td>Conda</td>
5555
<td>
5656
<a href="http://pandas.pydata.org">
57-
<img src="http://pubbadges.s3-website-us-east-1.amazonaws.com/pkgs-downloads-pandas.png" alt="conda downloads" />
57+
<img src="http://pubbadges.s3-website-us-east-1.amazonaws.com/pkgs-downloads-pandas.png" alt="conda default downloads" />
58+
</a>
59+
</td>
60+
</tr>
61+
<tr>
62+
<td>Conda-forge</td>
63+
<td>
64+
<a href="http://pandas.pydata.org">
65+
<img src="https://anaconda.org/conda-forge/pandas/badges/downloads.svg" alt="conda-forge downloads" />
5866
</a>
5967
</td>
6068
</tr>

asv_bench/benchmarks/binary_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,4 +107,4 @@ def setup(self):
107107
self.s = Series(date_range('20010101', periods=self.N, freq='T', tz='US/Eastern'))
108108
self.ts = self.s[self.halfway]
109109

110-
self.s2 = Series(date_range('20010101', periods=self.N, freq='s', tz='US/Eastern'))
110+
self.s2 = Series(date_range('20010101', periods=self.N, freq='s', tz='US/Eastern'))

asv_bench/benchmarks/pandas_vb_common.py

+10-4
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,22 @@
88
import random
99
import numpy as np
1010
import threading
11+
from importlib import import_module
12+
1113
try:
1214
from pandas.compat import range
1315
except ImportError:
1416
pass
1517

1618
np.random.seed(1234)
17-
try:
18-
import pandas._tseries as lib
19-
except:
20-
import pandas.lib as lib
19+
20+
# try em until it works!
21+
for imp in ['pandas_tseries', 'pandas.lib', 'pandas._libs.lib']:
22+
try:
23+
lib = import_module(imp)
24+
break
25+
except:
26+
pass
2127

2228
try:
2329
Panel = Panel

asv_bench/benchmarks/panel_methods.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ def time_shift(self):
2121
self.panel.shift(1)
2222

2323
def time_shift_minor(self):
24-
self.panel.shift(1, axis='minor')
24+
self.panel.shift(1, axis='minor')

doc/make.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ def html():
197197
print(e)
198198
print("Failed to convert %s" % nb)
199199

200-
if os.system('sphinx-build -P -b html -d build/doctrees '
200+
if os.system('sphinx-build -j 2 -P -b html -d build/doctrees '
201201
'source build/html'):
202202
raise SystemExit("Building HTML failed.")
203203
try:
@@ -222,7 +222,7 @@ def latex():
222222
check_build()
223223
if sys.platform != 'win32':
224224
# LaTeX format.
225-
if os.system('sphinx-build -b latex -d build/doctrees '
225+
if os.system('sphinx-build -j 2 -b latex -d build/doctrees '
226226
'source build/latex'):
227227
raise SystemExit("Building LaTeX failed.")
228228
# Produce pdf.
@@ -245,7 +245,7 @@ def latex_forced():
245245
check_build()
246246
if sys.platform != 'win32':
247247
# LaTeX format.
248-
if os.system('sphinx-build -b latex -d build/doctrees '
248+
if os.system('sphinx-build -j 2 -b latex -d build/doctrees '
249249
'source build/latex'):
250250
raise SystemExit("Building LaTeX failed.")
251251
# Produce pdf.

doc/source/api.rst

+1-52
Original file line numberDiff line numberDiff line change
@@ -1237,58 +1237,7 @@ Serialization / IO / Conversion
12371237
Panel.to_frame
12381238
Panel.to_xarray
12391239
Panel.to_clipboard
1240-
1241-
.. _api.panel4d:
1242-
1243-
Panel4D
1244-
-------
1245-
1246-
Constructor
1247-
~~~~~~~~~~~
1248-
.. autosummary::
1249-
:toctree: generated/
1250-
1251-
Panel4D
1252-
1253-
Serialization / IO / Conversion
1254-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1255-
.. autosummary::
1256-
:toctree: generated/
1257-
1258-
Panel4D.to_xarray
1259-
1260-
Attributes and underlying data
1261-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1262-
**Axes**
1263-
1264-
* **labels**: axis 1; each label corresponds to a Panel contained inside
1265-
* **items**: axis 2; each item corresponds to a DataFrame contained inside
1266-
* **major_axis**: axis 3; the index (rows) of each of the DataFrames
1267-
* **minor_axis**: axis 4; the columns of each of the DataFrames
1268-
1269-
.. autosummary::
1270-
:toctree: generated/
1271-
1272-
Panel4D.values
1273-
Panel4D.axes
1274-
Panel4D.ndim
1275-
Panel4D.size
1276-
Panel4D.shape
1277-
Panel4D.dtypes
1278-
Panel4D.ftypes
1279-
Panel4D.get_dtype_counts
1280-
Panel4D.get_ftype_counts
1281-
1282-
Conversion
1283-
~~~~~~~~~~
1284-
.. autosummary::
1285-
:toctree: generated/
1286-
1287-
Panel4D.astype
1288-
Panel4D.copy
1289-
Panel4D.isnull
1290-
Panel4D.notnull
1291-
1240+
12921241
.. _api.index:
12931242

12941243
Index

doc/source/install.rst

-12
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,6 @@ Officially Python 2.7, 3.4, 3.5, and 3.6
2323
Installing pandas
2424
-----------------
2525

26-
Trying out pandas, no installation required!
27-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28-
29-
The easiest way to start experimenting with pandas doesn't involve installing
30-
pandas at all.
31-
32-
`Wakari <https://wakari.io>`__ is a free service that provides a hosted
33-
`IPython Notebook <http://ipython.org/notebook.html>`__ service in the cloud.
34-
35-
Simply create an account, and have access to pandas from within your brower via
36-
an `IPython Notebook <http://ipython.org/notebook.html>`__ in a few minutes.
37-
3826
.. _install.anaconda:
3927

4028
Installing pandas with Anaconda

doc/source/io.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -3758,7 +3758,7 @@ be data_columns
37583758
37593759
# on-disk operations
37603760
store.append('df_dc', df_dc, data_columns = ['B', 'C', 'string', 'string2'])
3761-
store.select('df_dc', [ pd.Term('B>0') ])
3761+
store.select('df_dc', where='B>0')
37623762
37633763
# getting creative
37643764
store.select('df_dc', 'B > 0 & C > 0 & string == foo')
@@ -4352,6 +4352,9 @@ HDFStore supports ``Panel4D`` storage.
43524352
.. ipython:: python
43534353
:okwarning:
43544354
4355+
wp = pd.Panel(randn(2, 5, 4), items=['Item1', 'Item2'],
4356+
major_axis=pd.date_range('1/1/2000', periods=5),
4357+
minor_axis=['A', 'B', 'C', 'D'])
43554358
p4d = pd.Panel4D({ 'l1' : wp })
43564359
p4d
43574360
store.append('p4d', p4d)
@@ -4368,8 +4371,7 @@ object). This cannot be changed after table creation.
43684371
:okwarning:
43694372
43704373
store.append('p4d2', p4d, axes=['labels', 'major_axis', 'minor_axis'])
4371-
store
4372-
store.select('p4d2', [ pd.Term('labels=l1'), pd.Term('items=Item1'), pd.Term('minor_axis=A_big_strings') ])
4374+
store.select('p4d2', where='labels=l1 and items=Item1 and minor_axis=A')
43734375
43744376
.. ipython:: python
43754377
:suppress:

doc/source/whatsnew/v0.20.0.txt

+35-2
Original file line numberDiff line numberDiff line change
@@ -484,6 +484,35 @@ New Behavior:
484484
In [11]: index.memory_usage(deep=True)
485485
Out[11]: 260
486486

487+
.. _whatsnew_0200.api_breaking.extensions:
488+
489+
Extension Modules Moved
490+
^^^^^^^^^^^^^^^^^^^^^^^
491+
492+
Some formerly public c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API.
493+
If indicated, a deprecation warning will be issued if you reference that module. (:issue:`12588`)
494+
495+
.. csv-table::
496+
:header: "Previous Location", "New Location", "Deprecated"
497+
:widths: 30, 30, 4
498+
499+
"pandas.lib", "pandas._libs.lib", "X"
500+
"pandas.tslib", "pandas._libs.tslib", "X"
501+
"pandas._join", "pandas._libs.join", ""
502+
"pandas._period", "pandas._libs.period", ""
503+
"pandas.msgpack", "pandas.io.msgpack", ""
504+
"pandas.index", "pandas._libs.index", ""
505+
"pandas.algos", "pandas._libs.algos", ""
506+
"pandas.hashtable", "pandas._libs.hashtable", ""
507+
"pandas.json", "pandas.io.json.libjson", "X"
508+
"pandas.parser", "pandas.io.libparsers", "X"
509+
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
510+
"pandas._testing", "pandas.util.libtesting", ""
511+
"pandas._sparse", "pandas.sparse.libsparse", ""
512+
"pandas._hash", "pandas.tools.libhash", ""
513+
"pandas._window", "pandas.core.libwindow", ""
514+
515+
487516
.. _whatsnew_0200.api_breaking.groupby_describe:
488517

489518
Groupby Describe Formatting
@@ -652,7 +681,7 @@ Bug Fixes
652681
- Bug in ``Index`` power operations with reversed operands (:issue:`14973`)
653682
- Bug in ``TimedeltaIndex`` addition where overflow was being allowed without error (:issue:`14816`)
654683
- Bug in ``TimedeltaIndex`` raising a ``ValueError`` when boolean indexing with ``loc`` (:issue:`14946`)
655-
- Bug in ``DatetimeIndex.round()`` and ``Timestamp.round()`` floating point accuracy when rounding by milliseconds (:issue: `14440`)
684+
- Bug in ``DatetimeIndex.round()`` and ``Timestamp.round()`` floating point accuracy when rounding by milliseconds or less (:issue: `14440`, :issue:`15578`)
656685
- Bug in ``astype()`` where ``inf`` values were incorrectly converted to integers. Now raises error now with ``astype()`` for Series and DataFrames (:issue:`14265`)
657686
- Bug in ``DataFrame(..).apply(to_numeric)`` when values are of type decimal.Decimal. (:issue:`14827`)
658687
- Bug in ``describe()`` when passing a numpy array which does not contain the median to the ``percentiles`` keyword argument (:issue:`14908`)
@@ -672,6 +701,10 @@ Bug Fixes
672701
- Bug in ``Rolling.quantile`` function that caused a segmentation fault when called with a quantile value outside of the range [0, 1] (:issue:`15463`)
673702

674703

704+
- Bug in ``SparseSeries.reindex`` on single level with list of length 1 (:issue:`15447`)
705+
706+
707+
675708
- Bug in the display of ``.info()`` where a qualifier (+) would always be displayed with a ``MultiIndex`` that contains only non-strings (:issue:`15245`)
676709

677710
- Bug in ``.asfreq()``, where frequency was not set for empty ``Series` (:issue:`14320`)
@@ -698,7 +731,7 @@ Bug Fixes
698731

699732
- Bug in ``to_sql`` when writing a DataFrame with numeric index names (:issue:`15404`).
700733
- Bug in ``Series.iloc`` where a ``Categorical`` object for list-like indexes input was returned, where a ``Series`` was expected. (:issue:`14580`)
701-
734+
- Bug in repr-formatting a ``SparseDataFrame`` after a value was set on (a copy of) one of its series (:issue:`15488`)
702735

703736

704737
- Bug in groupby operations with timedelta64 when passing ``numeric_only=False`` (:issue:`5724`)

pandas/__init__.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
from pandas.compat.numpy import *
2424

2525
try:
26-
from pandas import hashtable, tslib, lib
26+
from pandas._libs import (hashtable as _hashtable,
27+
lib as _lib,
28+
tslib as _tslib)
2729
except ImportError as e: # pragma: no cover
2830
# hack but overkill to use re
2931
module = str(e).lstrip('cannot import name ')
@@ -52,11 +54,17 @@
5254
from pandas.tools.util import to_numeric
5355
from pandas.core.reshape import melt
5456
from pandas.util.print_versions import show_versions
55-
5657
from pandas.io.api import *
57-
5858
from pandas.util._tester import test
5959

60+
# extension module deprecations
61+
from pandas.util.depr_module import _DeprecatedModule
62+
63+
json = _DeprecatedModule(deprmod='pandas.json', deprmodto='pandas.io.json.libjson')
64+
parser = _DeprecatedModule(deprmod='pandas.parser', deprmodto='pandas.io.libparsers')
65+
lib = _DeprecatedModule(deprmod='pandas.lib', deprmodto='pandas._libs.lib')
66+
tslib = _DeprecatedModule(deprmod='pandas.tslib', deprmodto='pandas._libs.tslib')
67+
6068
# use the closest tagged version if possible
6169
from ._version import get_versions
6270
v = get_versions()

pandas/_libs/__init__.py

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# flake8: noqa
2+
3+
from .tslib import iNaT, NaT, Timestamp, Timedelta, OutOfBoundsDatetime
4+
5+
# TODO
6+
# period is directly dependent on tslib and imports python
7+
# modules, so exposing Period as an alias is currently not possible
8+
# from period import Period

pandas/algos.pyx renamed to pandas/_libs/algos.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ float64 = np.dtype(np.float64)
3737
cdef double NaN = <double> np.NaN
3838
cdef double nan = NaN
3939

40-
cdef extern from "src/headers/math.h":
40+
cdef extern from "../src/headers/math.h":
4141
double sqrt(double x) nogil
4242
double fabs(double) nogil
4343

@@ -46,7 +46,7 @@ from util cimport numeric, get_nat
4646

4747
cimport lib
4848
from lib cimport is_null_datetimelike
49-
from pandas import lib
49+
from pandas._libs import lib
5050

5151
cdef int64_t iNaT = get_nat()
5252

pandas/src/algos_common_helper.pxi.in renamed to pandas/_libs/algos_common_helper.pxi.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ def arrmap_{{name}}(ndarray[{{c_type}}] index, object func):
433433

434434
cdef ndarray[object] result = np.empty(length, dtype=np.object_)
435435

436-
from pandas.lib import maybe_convert_objects
436+
from pandas._libs.lib import maybe_convert_objects
437437

438438
for i in range(length):
439439
result[i] = func(index[i])
File renamed without changes.

pandas/hashtable.pyx renamed to pandas/_libs/hashtable.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cdef extern from "numpy/npy_math.h":
2222
cimport cython
2323
cimport numpy as cnp
2424

25-
from pandas.lib import checknull
25+
from pandas._libs.lib import checknull
2626

2727
cnp.import_array()
2828
cnp.import_ufunc()

pandas/index.pyx renamed to pandas/_libs/index.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import numpy as np
1717

1818
cimport tslib
1919
from hashtable cimport *
20-
from pandas import algos, tslib, hashtable as _hash
21-
from pandas.tslib import Timestamp, Timedelta
20+
from pandas._libs import tslib, algos, hashtable as _hash
21+
from pandas._libs.tslib import Timestamp, Timedelta
2222

2323
from datetime cimport (get_datetime64_value, _pydatetime_to_dts,
2424
pandas_datetimestruct)

pandas/src/join.pyx renamed to pandas/_libs/join.pyx

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ float64 = np.dtype(np.float64)
3232
cdef double NaN = <double> np.NaN
3333
cdef double nan = NaN
3434

35-
from pandas.algos import groupsort_indexer, ensure_platform_int
35+
from pandas._libs.algos import groupsort_indexer, ensure_platform_int
3636
from pandas.core.algorithms import take_nd
3737

38-
include "joins_func_helper.pxi"
38+
include "join_func_helper.pxi"
3939

4040

4141
def inner_join(ndarray[int64_t] left, ndarray[int64_t] right,
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)