Skip to content

Commit ba7826f

Browse files
mroeschkejreback
authored andcommitted
CLN: Panel reference from documentation (#25649)
1 parent 02ada08 commit ba7826f

21 files changed

+41
-554
lines changed

doc/source/conf.py

-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import inspect
1717
import importlib
1818
import logging
19-
import warnings
2019
import jinja2
2120
from sphinx.ext.autosummary import _import_by_name
2221
from numpydoc.docscrape import NumpyDocString
@@ -412,12 +411,6 @@
412411
'wiki ')}
413412

414413

415-
# ignore all deprecation warnings from Panel during doc build
416-
# (to avoid the need to add :okwarning: in many places)
417-
warnings.filterwarnings("ignore", message="\nPanel is deprecated",
418-
category=FutureWarning)
419-
420-
421414
ipython_warning_is_error = False
422415
ipython_exec_lines = [
423416
'import numpy as np',

doc/source/development/extending.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ There are 3 constructor properties to be defined:
271271

272272
* ``_constructor``: Used when a manipulation result has the same dimensions as the original.
273273
* ``_constructor_sliced``: Used when a manipulation result has one lower dimension(s) as the original, such as ``DataFrame`` single columns slicing.
274-
* ``_constructor_expanddim``: Used when a manipulation result has one higher dimension as the original, such as ``Series.to_frame()`` and ``DataFrame.to_panel()``.
274+
* ``_constructor_expanddim``: Used when a manipulation result has one higher dimension as the original, such as ``Series.to_frame()``.
275275

276276
Following table shows how ``pandas`` data structures define constructor properties by default.
277277

@@ -280,7 +280,7 @@ Property Attributes ``Series`` ``DataFrame``
280280
=========================== ======================= =============
281281
``_constructor`` ``Series`` ``DataFrame``
282282
``_constructor_sliced`` ``NotImplementedError`` ``Series``
283-
``_constructor_expanddim`` ``DataFrame`` ``Panel``
283+
``_constructor_expanddim`` ``DataFrame`` ``NotImplementedError``
284284
=========================== ======================= =============
285285

286286
Below example shows how to define ``SubclassedSeries`` and ``SubclassedDataFrame`` overriding constructor properties.

doc/source/ecosystem.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ Pandas DataFrames with timeseries indexes.
217217
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
218218
PyDatastream is a Python interface to the
219219
`Thomson Dataworks Enterprise (DWE/Datastream) <http://dataworks.thomson.com/Dataworks/Enterprise/1.0/>`__
220-
SOAP API to return indexed Pandas DataFrames or Panels with financial data.
220+
SOAP API to return indexed Pandas DataFrames with financial data.
221221
This package requires valid credentials for this API (non free).
222222

223223
`pandaSDMX <https://pandasdmx.readthedocs.io>`__

doc/source/getting_started/10min.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,8 @@ Merge
449449
Concat
450450
~~~~~~
451451

452-
pandas provides various facilities for easily combining together Series,
453-
DataFrame, and Panel objects with various kinds of set logic for the indexes
452+
pandas provides various facilities for easily combining together Series and
453+
DataFrame objects with various kinds of set logic for the indexes
454454
and relational algebra functionality in the case of join / merge-type
455455
operations.
456456

doc/source/getting_started/basics.rst

+5-33
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ the previous section:
1616
s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])
1717
df = pd.DataFrame(np.random.randn(8, 3), index=index,
1818
columns=['A', 'B', 'C'])
19-
wp = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', 'Item2'],
20-
major_axis=pd.date_range('1/1/2000', periods=5),
21-
minor_axis=['A', 'B', 'C', 'D'])
2219
2320
.. _basics.head_tail:
2421

@@ -46,7 +43,6 @@ pandas objects have a number of attributes enabling you to access the metadata
4643
* Axis labels
4744
* **Series**: *index* (only axis)
4845
* **DataFrame**: *index* (rows) and *columns*
49-
* **Panel**: *items*, *major_axis*, and *minor_axis*
5046

5147
Note, **these attributes can be safely assigned to**!
5248

@@ -118,7 +114,7 @@ columns, :meth:`DataFrame.to_numpy` will return the underlying data:
118114
119115
df.to_numpy()
120116
121-
If a DataFrame or Panel contains homogeneously-typed data, the ndarray can
117+
If a DataFrame contains homogeneously-typed data, the ndarray can
122118
actually be modified in-place, and the changes will be reflected in the data
123119
structure. For heterogeneous data (e.g. some of the DataFrame's columns are not
124120
all the same dtype), this will not be the case. The values attribute itself,
@@ -239,26 +235,6 @@ Furthermore you can align a level of a MultiIndexed DataFrame with a Series.
239235
names=['first', 'second'])
240236
dfmi.sub(column, axis=0, level='second')
241237
242-
With Panel, describing the matching behavior is a bit more difficult, so
243-
the arithmetic methods instead (and perhaps confusingly?) give you the option
244-
to specify the *broadcast axis*. For example, suppose we wished to demean the
245-
data over a particular axis. This can be accomplished by taking the mean over
246-
an axis and broadcasting over the same axis:
247-
248-
.. ipython:: python
249-
250-
major_mean = wp.mean(axis='major')
251-
major_mean
252-
wp.sub(major_mean, axis='major')
253-
254-
And similarly for ``axis="items"`` and ``axis="minor"``.
255-
256-
.. note::
257-
258-
I could be convinced to make the **axis** argument in the DataFrame methods
259-
match the broadcasting behavior of Panel. Though it would require a
260-
transition period so users can change their code...
261-
262238
Series and Index also support the :func:`divmod` builtin. This function takes
263239
the floor division and modulo operation at the same time returning a two-tuple
264240
of the same type as the left hand side. For example:
@@ -407,7 +383,7 @@ This is because NaNs do not compare as equals:
407383
408384
np.nan == np.nan
409385
410-
So, NDFrames (such as Series, DataFrames, and Panels)
386+
So, NDFrames (such as Series and DataFrames)
411387
have an :meth:`~DataFrame.equals` method for testing equality, with NaNs in
412388
corresponding locations treated as equal.
413389

@@ -515,7 +491,7 @@ Descriptive statistics
515491

516492
There exists a large number of methods for computing descriptive statistics and
517493
other related operations on :ref:`Series <api.series.stats>`, :ref:`DataFrame
518-
<api.dataframe.stats>`, and :ref:`Panel <api.panel.stats>`. Most of these
494+
<api.dataframe.stats>`. Most of these
519495
are aggregations (hence producing a lower-dimensional result) like
520496
:meth:`~DataFrame.sum`, :meth:`~DataFrame.mean`, and :meth:`~DataFrame.quantile`,
521497
but some of them, like :meth:`~DataFrame.cumsum` and :meth:`~DataFrame.cumprod`,
@@ -525,8 +501,6 @@ specified by name or integer:
525501

526502
* **Series**: no axis argument needed
527503
* **DataFrame**: "index" (axis=0, default), "columns" (axis=1)
528-
* **Panel**: "items" (axis=0), "major" (axis=1, default), "minor"
529-
(axis=2)
530504

531505
For example:
532506

@@ -1481,15 +1455,14 @@ Iteration
14811455

14821456
The behavior of basic iteration over pandas objects depends on the type.
14831457
When iterating over a Series, it is regarded as array-like, and basic iteration
1484-
produces the values. Other data structures, like DataFrame and Panel,
1458+
produces the values. Other data structures, like DataFrame,
14851459
follow the dict-like convention of iterating over the "keys" of the
14861460
objects.
14871461

14881462
In short, basic iteration (``for i in object``) produces:
14891463

14901464
* **Series**: values
14911465
* **DataFrame**: column labels
1492-
* **Panel**: item labels
14931466

14941467
Thus, for example, iterating over a DataFrame gives you the column names:
14951468

@@ -1559,13 +1532,12 @@ through key-value pairs:
15591532

15601533
* **Series**: (index, scalar value) pairs
15611534
* **DataFrame**: (column, Series) pairs
1562-
* **Panel**: (item, DataFrame) pairs
15631535

15641536
For example:
15651537

15661538
.. ipython:: python
15671539
1568-
for item, frame in wp.iteritems():
1540+
for item, frame in df.iteritems():
15691541
print(item)
15701542
print(frame)
15711543

doc/source/getting_started/dsintro.rst

-183
Original file line numberDiff line numberDiff line change
@@ -847,186 +847,3 @@ completion mechanism so they can be tab-completed:
847847
848848
In [5]: df.fo<TAB> # noqa: E225, E999
849849
df.foo1 df.foo2
850-
851-
.. _basics.panel:
852-
853-
Panel
854-
-----
855-
856-
.. warning::
857-
858-
In 0.20.0, ``Panel`` is deprecated and will be removed in
859-
a future version. See the section :ref:`Deprecate Panel <dsintro.deprecate_panel>`.
860-
861-
Panel is a somewhat less-used, but still important container for 3-dimensional
862-
data. The term `panel data <https://en.wikipedia.org/wiki/Panel_data>`__ is
863-
derived from econometrics and is partially responsible for the name pandas:
864-
pan(el)-da(ta)-s. The names for the 3 axes are intended to give some semantic
865-
meaning to describing operations involving panel data and, in particular,
866-
econometric analysis of panel data. However, for the strict purposes of slicing
867-
and dicing a collection of DataFrame objects, you may find the axis names
868-
slightly arbitrary:
869-
870-
* **items**: axis 0, each item corresponds to a DataFrame contained inside
871-
* **major_axis**: axis 1, it is the **index** (rows) of each of the
872-
DataFrames
873-
* **minor_axis**: axis 2, it is the **columns** of each of the DataFrames
874-
875-
Construction of Panels works about like you would expect:
876-
877-
From 3D ndarray with optional axis labels
878-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
879-
880-
.. ipython:: python
881-
:okwarning:
882-
883-
wp = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', 'Item2'],
884-
major_axis=pd.date_range('1/1/2000', periods=5),
885-
minor_axis=['A', 'B', 'C', 'D'])
886-
wp
887-
888-
889-
From dict of DataFrame objects
890-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
891-
892-
.. ipython:: python
893-
:okwarning:
894-
895-
data = {'Item1': pd.DataFrame(np.random.randn(4, 3)),
896-
'Item2': pd.DataFrame(np.random.randn(4, 2))}
897-
pd.Panel(data)
898-
899-
Note that the values in the dict need only be **convertible to
900-
DataFrame**. Thus, they can be any of the other valid inputs to DataFrame as
901-
per above.
902-
903-
One helpful factory method is ``Panel.from_dict``, which takes a
904-
dictionary of DataFrames as above, and the following named parameters:
905-
906-
.. csv-table::
907-
:header: "Parameter", "Default", "Description"
908-
:widths: 10, 10, 40
909-
910-
intersect, ``False``, drops elements whose indices do not align
911-
orient, ``items``, use ``minor`` to use DataFrames' columns as panel items
912-
913-
For example, compare to the construction above:
914-
915-
.. ipython:: python
916-
:okwarning:
917-
918-
pd.Panel.from_dict(data, orient='minor')
919-
920-
Orient is especially useful for mixed-type DataFrames. If you pass a dict of
921-
DataFrame objects with mixed-type columns, all of the data will get upcasted to
922-
``dtype=object`` unless you pass ``orient='minor'``:
923-
924-
.. ipython:: python
925-
:okwarning:
926-
927-
df = pd.DataFrame({'a': ['foo', 'bar', 'baz'],
928-
'b': np.random.randn(3)})
929-
df
930-
data = {'item1': df, 'item2': df}
931-
panel = pd.Panel.from_dict(data, orient='minor')
932-
panel['a']
933-
panel['b']
934-
panel['b'].dtypes
935-
936-
.. note::
937-
938-
Panel, being less commonly used than Series and DataFrame,
939-
has been slightly neglected feature-wise. A number of methods and options
940-
available in DataFrame are not available in Panel.
941-
942-
.. _dsintro.to_panel:
943-
944-
From DataFrame using ``to_panel`` method
945-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
946-
947-
``to_panel`` converts a DataFrame with a two-level index to a Panel.
948-
949-
.. ipython:: python
950-
:okwarning:
951-
952-
midx = pd.MultiIndex(levels=[['one', 'two'], ['x', 'y']],
953-
codes=[[1, 1, 0, 0], [1, 0, 1, 0]])
954-
df = pd.DataFrame({'A': [1, 2, 3, 4], 'B': [5, 6, 7, 8]}, index=midx)
955-
df.to_panel()
956-
957-
.. _dsintro.panel_item_selection:
958-
959-
Item selection / addition / deletion
960-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
961-
962-
Similar to DataFrame functioning as a dict of Series, Panel is like a dict
963-
of DataFrames:
964-
965-
.. ipython:: python
966-
967-
wp['Item1']
968-
wp['Item3'] = wp['Item1'] / wp['Item2']
969-
970-
The API for insertion and deletion is the same as for DataFrame. And as with
971-
DataFrame, if the item is a valid Python identifier, you can access it as an
972-
attribute and tab-complete it in IPython.
973-
974-
Transposing
975-
~~~~~~~~~~~
976-
977-
A Panel can be rearranged using its ``transpose`` method (which does not make a
978-
copy by default unless the data are heterogeneous):
979-
980-
.. ipython:: python
981-
:okwarning:
982-
983-
wp.transpose(2, 0, 1)
984-
985-
Indexing / Selection
986-
~~~~~~~~~~~~~~~~~~~~
987-
988-
.. csv-table::
989-
:header: "Operation", "Syntax", "Result"
990-
:widths: 30, 20, 10
991-
992-
Select item, ``wp[item]``, DataFrame
993-
Get slice at major_axis label, ``wp.major_xs(val)``, DataFrame
994-
Get slice at minor_axis label, ``wp.minor_xs(val)``, DataFrame
995-
996-
For example, using the earlier example data, we could do:
997-
998-
.. ipython:: python
999-
1000-
wp['Item1']
1001-
wp.major_xs(wp.major_axis[2])
1002-
wp.minor_axis
1003-
wp.minor_xs('C')
1004-
1005-
Squeezing
1006-
~~~~~~~~~
1007-
1008-
Another way to change the dimensionality of an object is to ``squeeze`` a 1-len
1009-
object, similar to ``wp['Item1']``.
1010-
1011-
.. ipython:: python
1012-
:okwarning:
1013-
1014-
wp.reindex(items=['Item1']).squeeze()
1015-
wp.reindex(items=['Item1'], minor=['B']).squeeze()
1016-
1017-
1018-
Conversion to DataFrame
1019-
~~~~~~~~~~~~~~~~~~~~~~~
1020-
1021-
A Panel can be represented in 2D form as a hierarchically indexed
1022-
DataFrame. See the section :ref:`hierarchical indexing <advanced.hierarchical>`
1023-
for more on this. To convert a Panel to a DataFrame, use the ``to_frame``
1024-
method:
1025-
1026-
.. ipython:: python
1027-
:okwarning:
1028-
1029-
panel = pd.Panel(np.random.randn(3, 5, 4), items=['one', 'two', 'three'],
1030-
major_axis=pd.date_range('1/1/2000', periods=5),
1031-
minor_axis=['a', 'b', 'c', 'd'])
1032-
panel.to_frame()

doc/source/install.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ Optional Dependencies
255255
* `Cython <http://www.cython.org>`__: Only necessary to build development
256256
version. Version 0.28.2 or higher.
257257
* `SciPy <http://www.scipy.org>`__: miscellaneous statistical functions, Version 0.18.1 or higher
258-
* `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.
258+
* `xarray <http://xarray.pydata.org>`__: pandas like handling for > 2 dims. Version 0.7.0 or higher is recommended.
259259
* `PyTables <http://www.pytables.org>`__: necessary for HDF5-based storage, Version 3.4.2 or higher
260260
* `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.9.0): necessary for feather-based storage.
261261
* `Apache Parquet <https://parquet.apache.org/>`__, either `pyarrow <http://arrow.apache.org/docs/python/>`__ (>= 0.7.0) or `fastparquet <https://fastparquet.readthedocs.io/en/latest>`__ (>= 0.2.1) for parquet-based storage. The `snappy <https://pypi.org/project/python-snappy>`__ and `brotli <https://pypi.org/project/brotlipy>`__ are available for compression support.

doc/source/reference/index.rst

-9
Original file line numberDiff line numberDiff line change
@@ -57,15 +57,6 @@ public functions related to data types in pandas.
5757
api/pandas.Index.is_type_compatible
5858
api/pandas.Index.nlevels
5959
api/pandas.Index.sort
60-
api/pandas.Panel.agg
61-
api/pandas.Panel.aggregate
62-
api/pandas.Panel.blocks
63-
api/pandas.Panel.empty
64-
api/pandas.Panel.is_copy
65-
api/pandas.Panel.items
66-
api/pandas.Panel.ix
67-
api/pandas.Panel.major_axis
68-
api/pandas.Panel.minor_axis
6960
api/pandas.Series.asobject
7061
api/pandas.Series.blocks
7162
api/pandas.Series.from_array

0 commit comments

Comments
 (0)