1515
1616import numpy as np
1717
18- from pandas ._libs import algos , lib , writers as libwriters
18+ from pandas ._libs import lib , writers as libwriters
1919from pandas ._libs .tslibs import timezones
2020from pandas .compat import PY3 , filter , lrange , range , string_types
2121from pandas .errors import PerformanceWarning
2222
2323from pandas .core .dtypes .common import (
24- ensure_int64 , ensure_object , ensure_platform_int , is_categorical_dtype ,
25- is_datetime64_dtype , is_datetime64tz_dtype , is_list_like ,
26- is_timedelta64_dtype )
24+ ensure_object , is_categorical_dtype , is_datetime64_dtype ,
25+ is_datetime64tz_dtype , is_list_like , is_timedelta64_dtype )
2726from pandas .core .dtypes .missing import array_equivalent
2827
2928from pandas import (
30- DataFrame , DatetimeIndex , Index , Int64Index , MultiIndex , Panel ,
31- PeriodIndex , Series , SparseDataFrame , SparseSeries , TimedeltaIndex , compat ,
32- concat , isna , to_datetime )
29+ DataFrame , DatetimeIndex , Index , Int64Index , MultiIndex , PeriodIndex ,
30+ Series , SparseDataFrame , SparseSeries , TimedeltaIndex , compat , concat ,
31+ isna , to_datetime )
3332from pandas .core import config
34- from pandas .core .algorithms import unique
35- from pandas .core .arrays .categorical import (
36- Categorical , _factorize_from_iterables )
33+ from pandas .core .arrays .categorical import Categorical
3734from pandas .core .arrays .sparse import BlockIndex , IntIndex
3835from pandas .core .base import StringMixin
3936import pandas .core .common as com
4037from pandas .core .computation .pytables import Expr , maybe_expression
4138from pandas .core .config import get_option
4239from pandas .core .index import ensure_index
43- from pandas .core .internals import (
44- BlockManager , _block2d_to_blocknd , _block_shape , _factor_indexer ,
45- make_block )
40+ from pandas .core .internals import BlockManager , _block_shape , make_block
4641
4742from pandas .io .common import _stringify_path
4843from pandas .io .formats .printing import adjoin , pprint_thing
@@ -175,7 +170,6 @@ class DuplicateWarning(Warning):
175170 SparseSeries : u'sparse_series' ,
176171 DataFrame : u'frame' ,
177172 SparseDataFrame : u'sparse_frame' ,
178- Panel : u'wide' ,
179173}
180174
181175# storer class map
@@ -187,7 +181,6 @@ class DuplicateWarning(Warning):
187181 u'sparse_series' : 'SparseSeriesFixed' ,
188182 u'frame' : 'FrameFixed' ,
189183 u'sparse_frame' : 'SparseFrameFixed' ,
190- u'wide' : 'PanelFixed' ,
191184}
192185
193186# table class map
@@ -198,14 +191,11 @@ class DuplicateWarning(Warning):
198191 u'appendable_frame' : 'AppendableFrameTable' ,
199192 u'appendable_multiframe' : 'AppendableMultiFrameTable' ,
200193 u'worm' : 'WORMTable' ,
201- u'legacy_frame' : 'LegacyFrameTable' ,
202- u'legacy_panel' : 'LegacyPanelTable' ,
203194}
204195
205196# axes map
206197_AXES_MAP = {
207198 DataFrame : [0 ],
208- Panel : [1 , 2 ]
209199}
210200
211201# register our configuration options
@@ -864,7 +854,7 @@ def put(self, key, value, format=None, append=False, **kwargs):
864854 Parameters
865855 ----------
866856 key : object
867- value : {Series, DataFrame, Panel }
857+ value : {Series, DataFrame}
868858 format : 'fixed(f)|table(t)', default is 'fixed'
869859 fixed(f) : Fixed format
870860 Fast writing/reading. Not-appendable, nor searchable
@@ -946,7 +936,7 @@ def append(self, key, value, format=None, append=True, columns=None,
946936 Parameters
947937 ----------
948938 key : object
949- value : {Series, DataFrame, Panel }
939+ value : {Series, DataFrame}
950940 format : 'table' is the default
951941 table(t) : table format
952942 Write as a PyTables Table structure which may perform
@@ -3027,16 +3017,6 @@ class FrameFixed(BlockManagerFixed):
30273017 obj_type = DataFrame
30283018
30293019
3030- class PanelFixed (BlockManagerFixed ):
3031- pandas_kind = u'wide'
3032- obj_type = Panel
3033- is_shape_reversed = True
3034-
3035- def write (self , obj , ** kwargs ):
3036- obj ._consolidate_inplace ()
3037- return super (PanelFixed , self ).write (obj , ** kwargs )
3038-
3039-
30403020class Table (Fixed ):
30413021
30423022 """ represent a table:
@@ -3899,85 +3879,11 @@ def read(self, where=None, columns=None, **kwargs):
38993879 if not self .read_axes (where = where , ** kwargs ):
39003880 return None
39013881
3902- lst_vals = [a .values for a in self .index_axes ]
3903- labels , levels = _factorize_from_iterables (lst_vals )
3904- # labels and levels are tuples but lists are expected
3905- labels = list (labels )
3906- levels = list (levels )
3907- N = [len (lvl ) for lvl in levels ]
3908-
3909- # compute the key
3910- key = _factor_indexer (N [1 :], labels )
3911-
3912- objs = []
3913- if len (unique (key )) == len (key ):
3914-
3915- sorter , _ = algos .groupsort_indexer (
3916- ensure_int64 (key ), np .prod (N ))
3917- sorter = ensure_platform_int (sorter )
3918-
3919- # create the objs
3920- for c in self .values_axes :
3921-
3922- # the data need to be sorted
3923- sorted_values = c .take_data ().take (sorter , axis = 0 )
3924- if sorted_values .ndim == 1 :
3925- sorted_values = sorted_values .reshape (
3926- (sorted_values .shape [0 ], 1 ))
3927-
3928- take_labels = [l .take (sorter ) for l in labels ]
3929- items = Index (c .values )
3930- block = _block2d_to_blocknd (
3931- values = sorted_values , placement = np .arange (len (items )),
3932- shape = tuple (N ), labels = take_labels , ref_items = items )
3933-
3934- # create the object
3935- mgr = BlockManager ([block ], [items ] + levels )
3936- obj = self .obj_type (mgr )
3937-
3938- # permute if needed
3939- if self .is_transposed :
3940- obj = obj .transpose (
3941- * tuple (Series (self .data_orientation ).argsort ()))
3942-
3943- objs .append (obj )
3944-
3945- else :
3946- raise NotImplementedError ("Panel is removed in pandas 0.25.0" )
3947-
3948- # create the composite object
3949- if len (objs ) == 1 :
3950- wp = objs [0 ]
3951- else :
3952- wp = concat (objs , axis = 0 , verify_integrity = False )._consolidate ()
3953-
3954- # apply the selection filters & axis orderings
3955- wp = self .process_axes (wp , columns = columns )
3956-
3957- return wp
3958-
3959-
3960- class LegacyFrameTable (LegacyTable ):
3961-
3962- """ support the legacy frame table """
3963- pandas_kind = u'frame_table'
3964- table_type = u'legacy_frame'
3965- obj_type = Panel
3966-
3967- def read (self , * args , ** kwargs ):
3968- return super (LegacyFrameTable , self ).read (* args , ** kwargs )['value' ]
3969-
3970-
3971- class LegacyPanelTable (LegacyTable ):
3972-
3973- """ support the legacy panel table """
3974- table_type = u'legacy_panel'
3975- obj_type = Panel
3882+ raise NotImplementedError ("Panel is removed in pandas 0.25.0" )
39763883
39773884
39783885class AppendableTable (LegacyTable ):
3979-
3980- """ suppor the new appendable table formats """
3886+ """ support the new appendable table formats """
39813887 _indexables = None
39823888 table_type = u'appendable'
39833889
@@ -4209,8 +4115,7 @@ def delete(self, where=None, start=None, stop=None, **kwargs):
42094115
42104116
42114117class AppendableFrameTable (AppendableTable ):
4212-
4213- """ suppor the new appendable table formats """
4118+ """ support the new appendable table formats """
42144119 pandas_kind = u'frame_table'
42154120 table_type = u'appendable_frame'
42164121 ndim = 2
0 commit comments