From cde4cee80f398d05d55182b4611707c759ee31fd Mon Sep 17 00:00:00 2001 From: ArtificialQualia Date: Fri, 8 Mar 2019 18:04:03 -0500 Subject: [PATCH 1/4] DOC: Remove makePanel from docs (#25609) --- doc/source/getting_started/dsintro.rst | 44 --------------------- doc/source/whatsnew/v0.13.1.rst | 54 -------------------------- doc/source/whatsnew/v0.20.0.rst | 28 ------------- doc/source/whatsnew/v0.23.0.rst | 33 ---------------- 4 files changed, 159 deletions(-) diff --git a/doc/source/getting_started/dsintro.rst b/doc/source/getting_started/dsintro.rst index c8a2399739cd5..373cffd30ff14 100644 --- a/doc/source/getting_started/dsintro.rst +++ b/doc/source/getting_started/dsintro.rst @@ -1030,47 +1030,3 @@ method: major_axis=pd.date_range('1/1/2000', periods=5), minor_axis=['a', 'b', 'c', 'd']) panel.to_frame() - - -.. _dsintro.deprecate_panel: - -Deprecate Panel ---------------- - -Over the last few years, pandas has increased in both breadth and depth, with new features, -datatype support, and manipulation routines. As a result, supporting efficient indexing and functional -routines for ``Series``, ``DataFrame`` and ``Panel`` has contributed to an increasingly fragmented and -difficult-to-understand code base. - -The 3-D structure of a ``Panel`` is much less common for many types of data analysis, -than the 1-D of the ``Series`` or the 2-D of the ``DataFrame``. Going forward it makes sense for -pandas to focus on these areas exclusively. - -Oftentimes, one can simply use a MultiIndex ``DataFrame`` for easily working with higher dimensional data. - -In addition, the ``xarray`` package was built from the ground up, specifically in order to -support the multi-dimensional analysis that is one of ``Panel`` s main use cases. -`Here is a link to the xarray panel-transition documentation `__. - -.. ipython:: python - :okwarning: - - import pandas.util.testing as tm - p = tm.makePanel() - p - -Convert to a MultiIndex DataFrame. - -.. ipython:: python - :okwarning: - - p.to_frame() - -Alternatively, one can convert to an xarray ``DataArray``. - -.. ipython:: python - :okwarning: - - p.to_xarray() - -You can see the full-documentation for the `xarray package `__. diff --git a/doc/source/whatsnew/v0.13.1.rst b/doc/source/whatsnew/v0.13.1.rst index 8a89450be2f48..5144c564204d6 100644 --- a/doc/source/whatsnew/v0.13.1.rst +++ b/doc/source/whatsnew/v0.13.1.rst @@ -222,60 +222,6 @@ Enhancements - Panel :meth:`~pandas.Panel.apply` will work on non-ufuncs. See :ref:`the docs`. - .. ipython:: python - - import pandas.util.testing as tm - panel = tm.makePanel(5) - panel - panel['ItemA'] - - Specifying an ``apply`` that operates on a Series (to return a single element) - - .. ipython:: python - - panel.apply(lambda x: x.dtype, axis='items') - - A similar reduction type operation - - .. ipython:: python - - panel.apply(lambda x: x.sum(), axis='major_axis') - - This is equivalent to - - .. ipython:: python - - panel.sum('major_axis') - - A transformation operation that returns a Panel, but is computing - the z-score across the major_axis - - .. ipython:: python - - result = panel.apply(lambda x: (x - x.mean()) / x.std(), - axis='major_axis') - result - result['ItemA'] - -- Panel :meth:`~pandas.Panel.apply` operating on cross-sectional slabs. (:issue:`1148`) - - .. ipython:: python - - def f(x): - return ((x.T - x.mean(1)) / x.std(1)).T - - result = panel.apply(f, axis=['items', 'major_axis']) - result - result.loc[:, :, 'ItemA'] - - This is equivalent to the following - - .. ipython:: python - - result = pd.Panel({ax: f(panel.loc[:, :, ax]) for ax in panel.minor_axis}) - - result - result.loc[:, :, 'ItemA'] Performance ~~~~~~~~~~~ diff --git a/doc/source/whatsnew/v0.20.0.rst b/doc/source/whatsnew/v0.20.0.rst index c720e075012eb..42fb8236b8fbc 100644 --- a/doc/source/whatsnew/v0.20.0.rst +++ b/doc/source/whatsnew/v0.20.0.rst @@ -1354,34 +1354,6 @@ Using ``.iloc``. Here we will get the location of the 'A' column, then use *posi df.iloc[[0, 2], df.columns.get_loc('A')] -.. _whatsnew_0200.api_breaking.deprecate_panel: - -Deprecate Panel -^^^^^^^^^^^^^^^ - -``Panel`` is deprecated and will be removed in a future version. The recommended way to represent 3-D data are -with a ``MultiIndex`` on a ``DataFrame`` via the :meth:`~Panel.to_frame` or with the `xarray package `__. Pandas -provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more details see :ref:`Deprecate Panel ` documentation. (:issue:`13563`). - -.. ipython:: python - :okwarning: - - p = tm.makePanel() - p - -Convert to a MultiIndex DataFrame - -.. ipython:: python - - p.to_frame() - -Convert to an xarray DataArray - -.. ipython:: python - :okwarning: - - p.to_xarray() - .. _whatsnew_0200.api_breaking.deprecate_group_agg_dict: Deprecate groupby.agg() with a dictionary when renaming diff --git a/doc/source/whatsnew/v0.23.0.rst b/doc/source/whatsnew/v0.23.0.rst index e52a36a922bd9..1e1515ff63653 100644 --- a/doc/source/whatsnew/v0.23.0.rst +++ b/doc/source/whatsnew/v0.23.0.rst @@ -637,39 +637,6 @@ If you wish to retain the old behavior while using Python >= 3.6, you can use 'Taxes': -200, 'Net result': 300}).sort_index() -.. _whatsnew_0230.api_breaking.deprecate_panel: - -Deprecate Panel -^^^^^^^^^^^^^^^ - -``Panel`` was deprecated in the 0.20.x release, showing as a ``DeprecationWarning``. Using ``Panel`` will now show a ``FutureWarning``. The recommended way to represent 3-D data are -with a ``MultiIndex`` on a ``DataFrame`` via the :meth:`~Panel.to_frame` or with the `xarray package `__. Pandas -provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more details see :ref:`Deprecate Panel ` documentation. (:issue:`13563`, :issue:`18324`). - -.. ipython:: python - :suppress: - - import pandas.util.testing as tm - -.. ipython:: python - :okwarning: - - p = tm.makePanel() - p - -Convert to a MultiIndex DataFrame - -.. ipython:: python - - p.to_frame() - -Convert to an xarray DataArray - -.. ipython:: python - :okwarning: - - p.to_xarray() - .. _whatsnew_0230.api_breaking.core_common: From 63627ff0cf54b13b720be16b888566c7bff4ad5f Mon Sep 17 00:00:00 2001 From: ArtificialQualia Date: Fri, 8 Mar 2019 19:08:40 -0500 Subject: [PATCH 2/4] removing unused import --- doc/source/whatsnew/v0.20.0.rst | 5 ----- 1 file changed, 5 deletions(-) diff --git a/doc/source/whatsnew/v0.20.0.rst b/doc/source/whatsnew/v0.20.0.rst index 42fb8236b8fbc..d5ff6c37787b1 100644 --- a/doc/source/whatsnew/v0.20.0.rst +++ b/doc/source/whatsnew/v0.20.0.rst @@ -45,11 +45,6 @@ Check the :ref:`API Changes ` and :ref:`deprecations New features ~~~~~~~~~~~~ -.. ipython:: python - :suppress: - - import pandas.util.testing as tm - .. _whatsnew_0200.enhancements.agg: ``agg`` API for DataFrame/Series From 1a7f6ce93c0892041cd4b5add947ae467656ed3b Mon Sep 17 00:00:00 2001 From: ArtificialQualia Date: Sat, 9 Mar 2019 13:17:37 -0500 Subject: [PATCH 3/4] convert old whatsnew using makePanel to code-blocks --- doc/source/whatsnew/v0.13.1.rst | 149 ++++++++++++++++++++++++++++++++ doc/source/whatsnew/v0.20.0.rst | 67 ++++++++++++++ doc/source/whatsnew/v0.23.0.rst | 67 ++++++++++++++ 3 files changed, 283 insertions(+) diff --git a/doc/source/whatsnew/v0.13.1.rst b/doc/source/whatsnew/v0.13.1.rst index 5144c564204d6..7d28370f5b4d2 100644 --- a/doc/source/whatsnew/v0.13.1.rst +++ b/doc/source/whatsnew/v0.13.1.rst @@ -222,6 +222,155 @@ Enhancements - Panel :meth:`~pandas.Panel.apply` will work on non-ufuncs. See :ref:`the docs`. + .. code-block:: ipython + + In [28]: import pandas.util.testing as tm + + In [29]: panel = tm.makePanel(5) + + In [30]: panel + Out[30]: + + Dimensions: 3 (items) x 5 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemC + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: A to D + + In [31]: panel['ItemA'] + Out[31]: + A B C D + 2000-01-03 -0.673690 0.577046 -1.344312 -1.469388 + 2000-01-04 0.113648 -1.715002 0.844885 0.357021 + 2000-01-05 -1.478427 -1.039268 1.075770 -0.674600 + 2000-01-06 0.524988 -0.370647 -0.109050 -1.776904 + 2000-01-07 0.404705 -1.157892 1.643563 -0.968914 + + [5 rows x 4 columns] + + Specifying an ``apply`` that operates on a Series (to return a single element) + + .. code-block:: ipython + + In [32]: panel.apply(lambda x: x.dtype, axis='items') + Out[32]: + A B C D + 2000-01-03 float64 float64 float64 float64 + 2000-01-04 float64 float64 float64 float64 + 2000-01-05 float64 float64 float64 float64 + 2000-01-06 float64 float64 float64 float64 + 2000-01-07 float64 float64 float64 float64 + + [5 rows x 4 columns] + + A similar reduction type operation + + .. code-block:: ipython + + In [33]: panel.apply(lambda x: x.sum(), axis='major_axis') + Out[33]: + ItemA ItemB ItemC + A -1.108775 -1.090118 -2.984435 + B -3.705764 0.409204 1.866240 + C 2.110856 2.960500 -0.974967 + D -4.532785 0.303202 -3.685193 + + [4 rows x 3 columns] + + This is equivalent to + + .. code-block:: ipython + + In [34]: panel.sum('major_axis') + Out[34]: + ItemA ItemB ItemC + A -1.108775 -1.090118 -2.984435 + B -3.705764 0.409204 1.866240 + C 2.110856 2.960500 -0.974967 + D -4.532785 0.303202 -3.685193 + + [4 rows x 3 columns] + + A transformation operation that returns a Panel, but is computing + the z-score across the major_axis + + .. code-block:: ipython + + In [35]: result = panel.apply(lambda x: (x - x.mean()) / x.std(), + ....: axis='major_axis') + ....: + + In [36]: result + Out[36]: + + Dimensions: 3 (items) x 5 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemC + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: A to D + + In [37]: result['ItemA'] + Out[37]: + A B C D + 2000-01-03 -0.535778 1.500802 -1.506416 -0.681456 + 2000-01-04 0.397628 -1.108752 0.360481 1.529895 + 2000-01-05 -1.489811 -0.339412 0.557374 0.280845 + 2000-01-06 0.885279 0.421830 -0.453013 -1.053785 + 2000-01-07 0.742682 -0.474468 1.041575 -0.075499 + + [5 rows x 4 columns] + +- Panel :meth:`~pandas.Panel.apply` operating on cross-sectional slabs. (:issue:`1148`) + + .. code-block:: ipython + + In [38]: def f(x): + ....: return ((x.T - x.mean(1)) / x.std(1)).T + ....: + + In [39]: result = panel.apply(f, axis=['items', 'major_axis']) + + In [40]: result + Out[40]: + + Dimensions: 4 (items) x 5 (major_axis) x 3 (minor_axis) + Items axis: A to D + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: ItemA to ItemC + + In [41]: result.loc[:, :, 'ItemA'] + Out[41]: + A B C D + 2000-01-03 0.012922 -0.030874 -0.629546 -0.757034 + 2000-01-04 0.392053 -1.071665 0.163228 0.548188 + 2000-01-05 -1.093650 -0.640898 0.385734 -1.154310 + 2000-01-06 1.005446 -1.154593 -0.595615 -0.809185 + 2000-01-07 0.783051 -0.198053 0.919339 -1.052721 + + [5 rows x 4 columns] + + This is equivalent to the following + + .. code-block:: ipython + + In [42]: result = pd.Panel({ax: f(panel.loc[:, :, ax]) for ax in panel.minor_axis}) + + In [43]: result + Out[43]: + + Dimensions: 4 (items) x 5 (major_axis) x 3 (minor_axis) + Items axis: A to D + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 + Minor_axis axis: ItemA to ItemC + + In [44]: result.loc[:, :, 'ItemA'] + Out[44]: + A B C D + 2000-01-03 0.012922 -0.030874 -0.629546 -0.757034 + 2000-01-04 0.392053 -1.071665 0.163228 0.548188 + 2000-01-05 -1.093650 -0.640898 0.385734 -1.154310 + 2000-01-06 1.005446 -1.154593 -0.595615 -0.809185 + 2000-01-07 0.783051 -0.198053 0.919339 -1.052721 + + [5 rows x 4 columns] Performance ~~~~~~~~~~~ diff --git a/doc/source/whatsnew/v0.20.0.rst b/doc/source/whatsnew/v0.20.0.rst index d5ff6c37787b1..d1d6121f73fa0 100644 --- a/doc/source/whatsnew/v0.20.0.rst +++ b/doc/source/whatsnew/v0.20.0.rst @@ -1349,6 +1349,73 @@ Using ``.iloc``. Here we will get the location of the 'A' column, then use *posi df.iloc[[0, 2], df.columns.get_loc('A')] +.. _whatsnew_0200.api_breaking.deprecate_panel: + +Deprecate Panel +^^^^^^^^^^^^^^^ + +``Panel`` is deprecated and will be removed in a future version. The recommended way to represent 3-D data are +with a ``MultiIndex`` on a ``DataFrame`` via the :meth:`~Panel.to_frame` or with the `xarray package `__. Pandas +provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more details see :ref:`Deprecate Panel ` documentation. (:issue:`13563`). + +.. code-block:: ipython + + In [134]: p = tm.makePanel() + + In [135]: p + Out[135]: + + Dimensions: 3 (items) x 3 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemC + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-05 00:00:00 + Minor_axis axis: A to D + +Convert to a MultiIndex DataFrame + +.. code-block:: ipython + + In [136]: p.to_frame() + Out[136]: + ItemA ItemB ItemC + major minor + 2000-01-03 A 0.628776 -1.409432 0.209395 + B 0.988138 -1.347533 -0.896581 + C -0.938153 1.272395 -0.161137 + D -0.223019 -0.591863 -1.051539 + 2000-01-04 A 0.186494 1.422986 -0.592886 + B -0.072608 0.363565 1.104352 + C -1.239072 -1.449567 0.889157 + D 2.123692 -0.414505 -0.319561 + 2000-01-05 A 0.952478 -2.147855 -1.473116 + B -0.550603 -0.014752 -0.431550 + C 0.139683 -1.195524 0.288377 + D 0.122273 -1.425795 -0.619993 + + [12 rows x 3 columns] + +Convert to an xarray DataArray + +.. code-block:: ipython + + In [137]: p.to_xarray() + Out[137]: + + array([[[ 0.628776, 0.988138, -0.938153, -0.223019], + [ 0.186494, -0.072608, -1.239072, 2.123692], + [ 0.952478, -0.550603, 0.139683, 0.122273]], + + [[-1.409432, -1.347533, 1.272395, -0.591863], + [ 1.422986, 0.363565, -1.449567, -0.414505], + [-2.147855, -0.014752, -1.195524, -1.425795]], + + [[ 0.209395, -0.896581, -0.161137, -1.051539], + [-0.592886, 1.104352, 0.889157, -0.319561], + [-1.473116, -0.43155 , 0.288377, -0.619993]]]) + Coordinates: + * items (items) object 'ItemA' 'ItemB' 'ItemC' + * major_axis (major_axis) datetime64[ns] 2000-01-03 2000-01-04 2000-01-05 + * minor_axis (minor_axis) object 'A' 'B' 'C' 'D' + .. _whatsnew_0200.api_breaking.deprecate_group_agg_dict: Deprecate groupby.agg() with a dictionary when renaming diff --git a/doc/source/whatsnew/v0.23.0.rst b/doc/source/whatsnew/v0.23.0.rst index 1e1515ff63653..bec1622d3af14 100644 --- a/doc/source/whatsnew/v0.23.0.rst +++ b/doc/source/whatsnew/v0.23.0.rst @@ -637,6 +637,73 @@ If you wish to retain the old behavior while using Python >= 3.6, you can use 'Taxes': -200, 'Net result': 300}).sort_index() +.. _whatsnew_0230.api_breaking.deprecate_panel: + +Deprecate Panel +^^^^^^^^^^^^^^^ + +``Panel`` was deprecated in the 0.20.x release, showing as a ``DeprecationWarning``. Using ``Panel`` will now show a ``FutureWarning``. The recommended way to represent 3-D data are +with a ``MultiIndex`` on a ``DataFrame`` via the :meth:`~Panel.to_frame` or with the `xarray package `__. Pandas +provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more details see :ref:`Deprecate Panel ` documentation. (:issue:`13563`, :issue:`18324`). + +.. code-block:: ipython + + In [76]: p = tm.makePanel() + + In [77]: p + Out[77]: + + Dimensions: 3 (items) x 3 (major_axis) x 4 (minor_axis) + Items axis: ItemA to ItemC + Major_axis axis: 2000-01-03 00:00:00 to 2000-01-05 00:00:00 + Minor_axis axis: A to D + +Convert to a MultiIndex DataFrame + +.. code-block:: ipython + + In [78]: p.to_frame() + Out[78]: + ItemA ItemB ItemC + major minor + 2000-01-03 A 0.469112 0.721555 0.404705 + B -1.135632 0.271860 -1.039268 + C 0.119209 0.276232 -1.344312 + D -2.104569 0.113648 -0.109050 + 2000-01-04 A -0.282863 -0.706771 0.577046 + B 1.212112 -0.424972 -0.370647 + C -1.044236 -1.087401 0.844885 + D -0.494929 -1.478427 1.643563 + 2000-01-05 A -1.509059 -1.039575 -1.715002 + B -0.173215 0.567020 -1.157892 + C -0.861849 -0.673690 1.075770 + D 1.071804 0.524988 -1.469388 + + [12 rows x 3 columns] + +Convert to an xarray DataArray + +.. code-block:: ipython + + In [79]: p.to_xarray() + Out[79]: + + array([[[ 0.469112, -1.135632, 0.119209, -2.104569], + [-0.282863, 1.212112, -1.044236, -0.494929], + [-1.509059, -0.173215, -0.861849, 1.071804]], + + [[ 0.721555, 0.27186 , 0.276232, 0.113648], + [-0.706771, -0.424972, -1.087401, -1.478427], + [-1.039575, 0.56702 , -0.67369 , 0.524988]], + + [[ 0.404705, -1.039268, -1.344312, -0.10905 ], + [ 0.577046, -0.370647, 0.844885, 1.643563], + [-1.715002, -1.157892, 1.07577 , -1.469388]]]) + Coordinates: + * items (items) object 'ItemA' 'ItemB' 'ItemC' + * major_axis (major_axis) datetime64[ns] 2000-01-03 2000-01-04 2000-01-05 + * minor_axis (minor_axis) object 'A' 'B' 'C' 'D' + .. _whatsnew_0230.api_breaking.core_common: From 14dd01a54f50352f139d197d514870fa8f5cf13e Mon Sep 17 00:00:00 2001 From: ArtificialQualia Date: Sat, 9 Mar 2019 14:46:45 -0500 Subject: [PATCH 4/4] fixes for passing linting --- doc/source/whatsnew/v0.13.1.rst | 28 ++++++++++++++-------------- doc/source/whatsnew/v0.20.0.rst | 10 ++++++---- doc/source/whatsnew/v0.23.0.rst | 10 ++++++---- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/doc/source/whatsnew/v0.13.1.rst b/doc/source/whatsnew/v0.13.1.rst index 7d28370f5b4d2..161b0ef395f05 100644 --- a/doc/source/whatsnew/v0.13.1.rst +++ b/doc/source/whatsnew/v0.13.1.rst @@ -229,7 +229,7 @@ Enhancements In [29]: panel = tm.makePanel(5) In [30]: panel - Out[30]: + Out[30]: Dimensions: 3 (items) x 5 (major_axis) x 4 (minor_axis) Items axis: ItemA to ItemC @@ -237,7 +237,7 @@ Enhancements Minor_axis axis: A to D In [31]: panel['ItemA'] - Out[31]: + Out[31]: A B C D 2000-01-03 -0.673690 0.577046 -1.344312 -1.469388 2000-01-04 0.113648 -1.715002 0.844885 0.357021 @@ -252,7 +252,7 @@ Enhancements .. code-block:: ipython In [32]: panel.apply(lambda x: x.dtype, axis='items') - Out[32]: + Out[32]: A B C D 2000-01-03 float64 float64 float64 float64 2000-01-04 float64 float64 float64 float64 @@ -267,7 +267,7 @@ Enhancements .. code-block:: ipython In [33]: panel.apply(lambda x: x.sum(), axis='major_axis') - Out[33]: + Out[33]: ItemA ItemB ItemC A -1.108775 -1.090118 -2.984435 B -3.705764 0.409204 1.866240 @@ -281,7 +281,7 @@ Enhancements .. code-block:: ipython In [34]: panel.sum('major_axis') - Out[34]: + Out[34]: ItemA ItemB ItemC A -1.108775 -1.090118 -2.984435 B -3.705764 0.409204 1.866240 @@ -297,18 +297,18 @@ Enhancements In [35]: result = panel.apply(lambda x: (x - x.mean()) / x.std(), ....: axis='major_axis') - ....: + ....: In [36]: result - Out[36]: + Out[36]: Dimensions: 3 (items) x 5 (major_axis) x 4 (minor_axis) Items axis: ItemA to ItemC Major_axis axis: 2000-01-03 00:00:00 to 2000-01-07 00:00:00 Minor_axis axis: A to D - In [37]: result['ItemA'] - Out[37]: + In [37]: result['ItemA'] # noqa E999 + Out[37]: A B C D 2000-01-03 -0.535778 1.500802 -1.506416 -0.681456 2000-01-04 0.397628 -1.108752 0.360481 1.529895 @@ -324,12 +324,12 @@ Enhancements In [38]: def f(x): ....: return ((x.T - x.mean(1)) / x.std(1)).T - ....: + ....: In [39]: result = panel.apply(f, axis=['items', 'major_axis']) In [40]: result - Out[40]: + Out[40]: Dimensions: 4 (items) x 5 (major_axis) x 3 (minor_axis) Items axis: A to D @@ -337,7 +337,7 @@ Enhancements Minor_axis axis: ItemA to ItemC In [41]: result.loc[:, :, 'ItemA'] - Out[41]: + Out[41]: A B C D 2000-01-03 0.012922 -0.030874 -0.629546 -0.757034 2000-01-04 0.392053 -1.071665 0.163228 0.548188 @@ -354,7 +354,7 @@ Enhancements In [42]: result = pd.Panel({ax: f(panel.loc[:, :, ax]) for ax in panel.minor_axis}) In [43]: result - Out[43]: + Out[43]: Dimensions: 4 (items) x 5 (major_axis) x 3 (minor_axis) Items axis: A to D @@ -362,7 +362,7 @@ Enhancements Minor_axis axis: ItemA to ItemC In [44]: result.loc[:, :, 'ItemA'] - Out[44]: + Out[44]: A B C D 2000-01-03 0.012922 -0.030874 -0.629546 -0.757034 2000-01-04 0.392053 -1.071665 0.163228 0.548188 diff --git a/doc/source/whatsnew/v0.20.0.rst b/doc/source/whatsnew/v0.20.0.rst index d1d6121f73fa0..26fdee4685c4b 100644 --- a/doc/source/whatsnew/v0.20.0.rst +++ b/doc/source/whatsnew/v0.20.0.rst @@ -1360,10 +1360,12 @@ provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more .. code-block:: ipython + In [133]: import pandas.util.testing as tm + In [134]: p = tm.makePanel() In [135]: p - Out[135]: + Out[135]: Dimensions: 3 (items) x 3 (major_axis) x 4 (minor_axis) Items axis: ItemA to ItemC @@ -1375,9 +1377,9 @@ Convert to a MultiIndex DataFrame .. code-block:: ipython In [136]: p.to_frame() - Out[136]: + Out[136]: ItemA ItemB ItemC - major minor + major minor 2000-01-03 A 0.628776 -1.409432 0.209395 B 0.988138 -1.347533 -0.896581 C -0.938153 1.272395 -0.161137 @@ -1398,7 +1400,7 @@ Convert to an xarray DataArray .. code-block:: ipython In [137]: p.to_xarray() - Out[137]: + Out[137]: array([[[ 0.628776, 0.988138, -0.938153, -0.223019], [ 0.186494, -0.072608, -1.239072, 2.123692], diff --git a/doc/source/whatsnew/v0.23.0.rst b/doc/source/whatsnew/v0.23.0.rst index bec1622d3af14..7ec5a39c3d384 100644 --- a/doc/source/whatsnew/v0.23.0.rst +++ b/doc/source/whatsnew/v0.23.0.rst @@ -648,10 +648,12 @@ provides a :meth:`~Panel.to_xarray` method to automate this conversion. For more .. code-block:: ipython + In [75]: import pandas.util.testing as tm + In [76]: p = tm.makePanel() In [77]: p - Out[77]: + Out[77]: Dimensions: 3 (items) x 3 (major_axis) x 4 (minor_axis) Items axis: ItemA to ItemC @@ -663,9 +665,9 @@ Convert to a MultiIndex DataFrame .. code-block:: ipython In [78]: p.to_frame() - Out[78]: + Out[78]: ItemA ItemB ItemC - major minor + major minor 2000-01-03 A 0.469112 0.721555 0.404705 B -1.135632 0.271860 -1.039268 C 0.119209 0.276232 -1.344312 @@ -686,7 +688,7 @@ Convert to an xarray DataArray .. code-block:: ipython In [79]: p.to_xarray() - Out[79]: + Out[79]: array([[[ 0.469112, -1.135632, 0.119209, -2.104569], [-0.282863, 1.212112, -1.044236, -0.494929],