Skip to content

Commit 005a09e

Browse files
committed
CLN: move top-level dirs
xref #13634 pandas.types -> pandas.core.dtypes pandas.computation -> pandas.core.computation pandas.sparse -> pandas.core.sparse Author: Jeff Reback <[email protected]> Closes #15998 from jreback/move_types and squashes the following commits: 5fe80ae [Jeff Reback] move fixtures to top-level conftest 9d36104 [Jeff Reback] moar ci d165a3f [Jeff Reback] more verbose built test 3ca5ba3 [Jeff Reback] pep f1505d7 [Jeff Reback] try with pyargs f63b76c [Jeff Reback] CLN: pandas.sparse -> pandas.core.sparse 751fb33 [Jeff Reback] move privacy changes to development section 221a7b5 [Jeff Reback] rename .typed -> .dtypes 290315e [Jeff Reback] move pandas.api.lib.infer_dtype -> pandas.api.types ba32641 [Jeff Reback] CLN: move pandas.computation -> pandas.core.computation bbdb1ee [Jeff Reback] CLN: move pandas.types -> pandas.core.typed
1 parent 7993fc8 commit 005a09e

File tree

186 files changed

+1021
-891
lines changed

Some content is hidden

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

186 files changed

+1021
-891
lines changed

asv_bench/benchmarks/binary_ops.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .pandas_vb_common import *
2-
import pandas.computation.expressions as expr
2+
import pandas.core.computation.expressions as expr
33

44

55
class Ops(object):

asv_bench/benchmarks/categoricals.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .pandas_vb_common import *
22
try:
3-
from pandas.types.concat import union_categoricals
3+
from pandas.core.dtypes.concat import union_categoricals
44
except ImportError:
55
pass
66

asv_bench/benchmarks/eval.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .pandas_vb_common import *
22
import pandas as pd
3-
import pandas.computation.expressions as expr
3+
import pandas.core.computation.expressions as expr
44

55

66
class Eval(object):

asv_bench/benchmarks/indexing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from .pandas_vb_common import *
22
try:
3-
import pandas.computation.expressions as expr
3+
import pandas.core.computation.expressions as expr
44
except:
55
expr = None
66

asv_bench/benchmarks/sparse.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .pandas_vb_common import *
2-
import pandas.sparse.series
2+
import pandas.core.sparse.series
33
import scipy.sparse
44
from pandas.core.sparse import SparseSeries, SparseDataFrame
55
from pandas.core.sparse import SparseDataFrame
@@ -37,7 +37,7 @@ def setup(self):
3737
self.A = scipy.sparse.coo_matrix(([3.0, 1.0, 2.0], ([1, 0, 0], [0, 2, 3])), shape=(100, 100))
3838

3939
def time_sparse_series_from_coo(self):
40-
self.ss = pandas.sparse.series.SparseSeries.from_coo(self.A)
40+
self.ss = pandas.core.sparse.series.SparseSeries.from_coo(self.A)
4141

4242

4343
class sparse_series_to_coo(object):

ci/install_travis.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ if [ "$BUILD_TEST" ]; then
123123

124124
# build & install testing
125125
echo ["Starting installation test."]
126+
rm -rf dist
126127
python setup.py clean
127128
python setup.py build_ext --inplace
128129
python setup.py sdist --formats=gztar

ci/script_multi.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ export PYTHONHASHSEED=$(python -c 'import random; print(random.randint(1, 429496
1919
echo PYTHONHASHSEED=$PYTHONHASHSEED
2020

2121
if [ "$BUILD_TEST" ]; then
22+
echo "build-test"
2223
cd /tmp
24+
pwd
25+
conda list pandas
26+
echo "running"
2327
python -c "import pandas; pandas.test(['-n 2'])"
2428
elif [ "$DOC" ]; then
2529
echo "We are not running pytest as this is a doc-build"

doc/source/categorical.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,7 @@ will be the union of the categories being combined.
673673

674674
.. ipython:: python
675675
676-
from pandas.types.concat import union_categoricals
676+
from pandas.api.types import union_categoricals
677677
a = pd.Categorical(["b", "c"])
678678
b = pd.Categorical(["a", "b"])
679679
union_categoricals([a, b])

doc/source/whatsnew/v0.20.0.txt

Lines changed: 72 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,11 @@ Highlights include:
2121
- Support for S3 handling now uses ``s3fs``, see :ref:`here <whatsnew_0200.api_breaking.s3>`
2222
- Google BigQuery support now uses the ``pandas-gbq`` library, see :ref:`here <whatsnew_0200.api_breaking.gbq>`
2323
- Switched the test framework to use `pytest <http://doc.pytest.org/en/latest>`__ (:issue:`13097`)
24-
- The ``pandas.tools.plotting`` module has been deprecated, moved to ``pandas.plotting``. See :ref:`here <whatsnew_0200.api_breaking.plotting>`
2524

25+
.. warning::
26+
27+
Pandas has changed the internal structure and layout of the codebase.
28+
This can affect imports that are not from the top-level ``pandas.*`` namespace, please see the changes :ref:`here <whatsnew_0200.privacy>`.
2629

2730
Check the :ref:`API Changes <whatsnew_0200.api_breaking>` and :ref:`deprecations <whatsnew_0200.deprecations>` before updating.
2831

@@ -489,7 +492,7 @@ Other Enhancements
489492

490493

491494
- ``TimedeltaIndex`` now has a custom datetick formatter specifically designed for nanosecond level precision (:issue:`8711`)
492-
- ``pd.types.concat.union_categoricals`` gained the ``ignore_ordered`` argument to allow ignoring the ordered attribute of unioned categoricals (:issue:`13410`). See the :ref:`categorical union docs <categorical.union>` for more information.
495+
- ``pd.api.types.union_categoricals`` gained the ``ignore_ordered`` argument to allow ignoring the ordered attribute of unioned categoricals (:issue:`13410`). See the :ref:`categorical union docs <categorical.union>` for more information.
493496
- ``DataFrame.to_latex()`` and ``DataFrame.to_string()`` now allow optional header aliases. (:issue:`15536`)
494497
- Re-enable the ``parse_dates`` keyword of ``pd.read_excel()`` to parse string columns as dates (:issue:`14326`)
495498
- Added ``.empty`` property to subclasses of ``Index``. (:issue:`15270`)
@@ -558,31 +561,6 @@ Using ``.iloc``. Here we will get the location of the 'A' column, then use *posi
558561
df.iloc[[0, 2], df.columns.get_loc('A')]
559562

560563

561-
.. _whatsnew_0200.api_breaking.deprecate_plotting
562-
563-
Deprecate .plotting
564-
^^^^^^^^^^^^^^^^^^^
565-
566-
The ``pandas.tools.plotting`` module has been deprecated, in favor of the top level ``pandas.plotting`` module. All the public plotting functions are now available
567-
from ``pandas.plotting`` (:issue:`12548`).
568-
569-
Furthermore, the top-level ``pandas.scatter_matrix`` and ``pandas.plot_params`` are deprecated.
570-
Users can import these from ``pandas.plotting`` as well.
571-
572-
Previous script:
573-
574-
.. code-block:: python
575-
576-
pd.tools.plotting.scatter_matrix(df)
577-
pd.scatter_matrix(df)
578-
579-
Should be changed to:
580-
581-
.. code-block:: python
582-
583-
pd.plotting.scatter_matrix(df)
584-
585-
586564
.. _whatsnew_0200.api_breaking.deprecate_panel:
587565

588566
Deprecate Panel
@@ -1026,34 +1004,6 @@ New Behavior:
10261004
In [11]: index.memory_usage(deep=True)
10271005
Out[11]: 260
10281006

1029-
.. _whatsnew_0200.api_breaking.extensions:
1030-
1031-
Extension Modules Moved
1032-
^^^^^^^^^^^^^^^^^^^^^^^
1033-
1034-
Some formerly public c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API.
1035-
If indicated, a deprecation warning will be issued if you reference that module. (:issue:`12588`)
1036-
1037-
.. csv-table::
1038-
:header: "Previous Location", "New Location", "Deprecated"
1039-
:widths: 30, 30, 4
1040-
1041-
"pandas.lib", "pandas._libs.lib", "X"
1042-
"pandas.tslib", "pandas._libs.tslib", "X"
1043-
"pandas._join", "pandas._libs.join", ""
1044-
"pandas._period", "pandas._libs.period", ""
1045-
"pandas.msgpack", "pandas.io.msgpack", ""
1046-
"pandas.index", "pandas._libs.index", ""
1047-
"pandas.algos", "pandas._libs.algos", ""
1048-
"pandas.hashtable", "pandas._libs.hashtable", ""
1049-
"pandas.json", "pandas.io.json.libjson", "X"
1050-
"pandas.parser", "pandas.io.libparsers", "X"
1051-
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
1052-
"pandas._testing", "pandas.util.libtesting", ""
1053-
"pandas._sparse", "pandas.sparse.libsparse", ""
1054-
"pandas._hash", "pandas.tools.libhash", ""
1055-
"pandas._window", "pandas.core.libwindow", ""
1056-
10571007
.. _whatsnew_0200.api_breaking.sort_index:
10581008

10591009
DataFrame.sort_index changes
@@ -1354,10 +1304,74 @@ Other API Changes
13541304
- ``DataFrame`` and ``Panel`` constructors with invalid input will now raise ``ValueError`` rather than ``pandas.core.common.PandasError``, if called with scalar inputs and not axes; The exception ``PandasError`` is removed as well. (:issue:`15541`)
13551305
- The exception ``pandas.core.common.AmbiguousIndexError`` is removed as it is not referenced (:issue:`15541`)
13561306

1357-
.. _whatsnew_0200.develop:
1307+
.. _whatsnew_0200.privacy:
1308+
1309+
Privacy Changes
1310+
~~~~~~~~~~~~~~~
1311+
1312+
.. _whatsnew_0200.privacy.extensions:
1313+
1314+
Modules Privacy Has Changed
1315+
^^^^^^^^^^^^^^^^^^^^^^^^^^^
1316+
1317+
Some formerly public python/c/c++/cython extension modules have been moved and/or renamed. These are all removed from the public API.
1318+
Furthermore, the ``pandas.core``, ``pandas.io``, and ``pandas.util`` top-level modules are now considered to be PRIVATE.
1319+
If indicated, a deprecation warning will be issued if you reference theses modules. (:issue:`12588`)
1320+
1321+
.. csv-table::
1322+
:header: "Previous Location", "New Location", "Deprecated"
1323+
:widths: 30, 30, 4
1324+
1325+
"pandas.lib", "pandas._libs.lib", "X"
1326+
"pandas.tslib", "pandas._libs.tslib", "X"
1327+
"pandas.computation", "pandas.core.computation", ""
1328+
"pandas.msgpack", "pandas.io.msgpack", ""
1329+
"pandas.index", "pandas._libs.index", ""
1330+
"pandas.algos", "pandas._libs.algos", ""
1331+
"pandas.hashtable", "pandas._libs.hashtable", ""
1332+
"pandas.json", "pandas.io.json.libjson", "X"
1333+
"pandas.parser", "pandas.io.libparsers", "X"
1334+
"pandas.sparse", "pandas.core.sparse", ""
1335+
"pandas.types", "pandas.core.dtypes", ""
1336+
"pandas.io.sas.saslib", "pandas.io.sas.libsas", ""
1337+
"pandas._join", "pandas._libs.join", ""
1338+
"pandas._hash", "pandas.tools.libhash", ""
1339+
"pandas._period", "pandas._libs.period", ""
1340+
"pandas._sparse", "pandas.core.sparse.libsparse", ""
1341+
"pandas._testing", "pandas.util.libtesting", ""
1342+
"pandas._window", "pandas.core.libwindow", ""
1343+
1344+
- The function :func:`~pandas.api.type.union_categoricals` is now importable from ``pandas.api.types``, formerly from ``pandas.types.concat`` (:issue:`15998`)
1345+
1346+
.. _whatsnew_0200.privacy.deprecate_plotting
1347+
1348+
Deprecate .plotting
1349+
^^^^^^^^^^^^^^^^^^^
1350+
1351+
The ``pandas.tools.plotting`` module has been deprecated, in favor of the top level ``pandas.plotting`` module. All the public plotting functions are now available
1352+
from ``pandas.plotting`` (:issue:`12548`).
1353+
1354+
Furthermore, the top-level ``pandas.scatter_matrix`` and ``pandas.plot_params`` are deprecated.
1355+
Users can import these from ``pandas.plotting`` as well.
1356+
1357+
Previous script:
1358+
1359+
.. code-block:: python
1360+
1361+
pd.tools.plotting.scatter_matrix(df)
1362+
pd.scatter_matrix(df)
1363+
1364+
Should be changed to:
1365+
1366+
.. code-block:: python
1367+
1368+
pd.plotting.scatter_matrix(df)
1369+
1370+
1371+
.. _whatsnew_0200.privacy.development:
13581372

1359-
Development Changes
1360-
~~~~~~~~~~~~~~~~~~~
1373+
Other Developement Changes
1374+
^^^^^^^^^^^^^^^^^^^^^^^^^^
13611375

13621376
- Building pandas for development now requires ``cython >= 0.23`` (:issue:`14831`)
13631377
- Require at least 0.23 version of cython to avoid problems with character encodings (:issue:`14699`)

pandas/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@
4040
import pandas.core.config_init
4141

4242
from pandas.core.api import *
43-
from pandas.sparse.api import *
43+
from pandas.core.sparse.api import *
4444
from pandas.stats.api import *
4545
from pandas.tseries.api import *
46-
from pandas.computation.api import *
46+
from pandas.core.computation.api import *
4747

4848
from pandas.tools.concat import concat
4949
from pandas.tools.merge import (merge, ordered_merge,

0 commit comments

Comments
 (0)