@@ -143,6 +143,7 @@ def f(self, other):
143
143
144
144
145
145
class Panel (NDFrame ):
146
+
146
147
"""
147
148
Represents wide format panel data, stored as 3-dimensional array
148
149
@@ -212,7 +213,7 @@ def _init_dict(self, data, axes, dtype=None):
212
213
in data .iteritems () if k in haxis )
213
214
else :
214
215
ks = data .keys ()
215
- if not isinstance (data ,OrderedDict ):
216
+ if not isinstance (data , OrderedDict ):
216
217
ks = _try_sort (ks )
217
218
haxis = Index (ks )
218
219
@@ -270,7 +271,7 @@ def from_dict(cls, data, intersect=False, orient='items', dtype=None):
270
271
-------
271
272
Panel
272
273
"""
273
- from pandas .util .compat import OrderedDict ,OrderedDefaultdict
274
+ from pandas .util .compat import OrderedDict , OrderedDefaultdict
274
275
275
276
orient = orient .lower ()
276
277
if orient == 'minor' :
@@ -284,7 +285,7 @@ def from_dict(cls, data, intersect=False, orient='items', dtype=None):
284
285
285
286
d = cls ._homogenize_dict (cls , data , intersect = intersect , dtype = dtype )
286
287
ks = d ['data' ].keys ()
287
- if not isinstance (d ['data' ],OrderedDict ):
288
+ if not isinstance (d ['data' ], OrderedDict ):
288
289
ks = list (sorted (ks ))
289
290
d [cls ._info_axis_name ] = Index (ks )
290
291
return cls (** d )
@@ -348,7 +349,7 @@ def _init_matrix(self, data, axes, dtype=None, copy=False):
348
349
ax = _ensure_index (ax )
349
350
fixed_axes .append (ax )
350
351
351
- return create_block_manager_from_blocks ([ values ], fixed_axes )
352
+ return create_block_manager_from_blocks ([values ], fixed_axes )
352
353
353
354
#----------------------------------------------------------------------
354
355
# Comparison methods
@@ -534,7 +535,7 @@ def set_value(self, *args):
534
535
axes = self ._expand_axes (args )
535
536
d = self ._construct_axes_dict_from (self , axes , copy = False )
536
537
result = self .reindex (** d )
537
- args = list (args )
538
+ args = list (args )
538
539
likely_dtype , args [- 1 ] = _infer_dtype_from_scalar (args [- 1 ])
539
540
made_bigger = not np .array_equal (
540
541
axes [0 ], self ._info_axis )
@@ -838,7 +839,7 @@ def _ixs(self, i, axis=0):
838
839
839
840
# xs cannot handle a non-scalar key, so just reindex here
840
841
if _is_list_like (key ):
841
- return self .reindex (** { self ._get_axis_name (axis ) : key })
842
+ return self .reindex (** {self ._get_axis_name (axis ): key })
842
843
843
844
return self .xs (key , axis = axis )
844
845
@@ -939,7 +940,7 @@ def _reduce(self, op, axis=0, skipna=True):
939
940
result = result .T
940
941
941
942
return self ._constructor_sliced (result ,
942
- ** self ._extract_axes_for_slice (self , axes ))
943
+ ** self ._extract_axes_for_slice (self , axes ))
943
944
944
945
def _wrap_result (self , result , axis ):
945
946
axis = self ._get_axis_name (axis )
@@ -952,7 +953,7 @@ def _wrap_result(self, result, axis):
952
953
return self ._constructor (result , ** self ._construct_axes_dict ())
953
954
elif self .ndim == result .ndim + 1 :
954
955
return self ._constructor_sliced (result ,
955
- ** self ._extract_axes_for_slice (self , axes ))
956
+ ** self ._extract_axes_for_slice (self , axes ))
956
957
957
958
raise PandasError ("invalid _wrap_result [self->%s] [result->%s]" %
958
959
(self .ndim , result .ndim ))
@@ -1115,7 +1116,7 @@ def update(self, other, join='left', overwrite=True, filter_func=None,
1115
1116
if not isinstance (other , self ._constructor ):
1116
1117
other = self ._constructor (other )
1117
1118
1118
- axis_name = self ._info_axis_name
1119
+ axis_name = self ._info_axis_name
1119
1120
axis_values = self ._info_axis
1120
1121
other = other .reindex (** {axis_name : axis_values })
1121
1122
@@ -1181,7 +1182,8 @@ def _homogenize_dict(self, frames, intersect=True, dtype=None):
1181
1182
from pandas .util .compat import OrderedDict
1182
1183
1183
1184
result = dict ()
1184
- if isinstance (frames ,OrderedDict ): # caller differs dict/ODict, presered type
1185
+ # caller differs dict/ODict, presered type
1186
+ if isinstance (frames , OrderedDict ):
1185
1187
result = OrderedDict ()
1186
1188
1187
1189
adj_frames = OrderedDict ()
@@ -1290,7 +1292,7 @@ def f(self, other, axis=0):
1290
1292
Parameters
1291
1293
----------
1292
1294
axis : {""" + ', ' .join (cls ._AXIS_ORDERS ) + "} or {" \
1293
- + ', ' .join ([str (i ) for i in range (cls ._AXIS_LEN )]) + """}
1295
+ + ', ' .join ([str (i ) for i in range (cls ._AXIS_LEN )]) + """}
1294
1296
skipna : boolean, default True
1295
1297
Exclude NA/null values. If an entire row/column is NA, the result
1296
1298
will be NA
@@ -1364,13 +1366,13 @@ def min(self, axis='major', skipna=True):
1364
1366
return self ._reduce (nanops .nanmin , axis = axis , skipna = skipna )
1365
1367
cls .min = min
1366
1368
1367
- Panel ._setup_axes (axes = ['items' , 'major_axis' , 'minor_axis' ],
1368
- info_axis = 0 ,
1369
- stat_axis = 1 ,
1370
- aliases = { 'major' : 'major_axis' ,
1371
- 'minor' : 'minor_axis' },
1372
- slicers = { 'major_axis' : 'index' ,
1373
- 'minor_axis' : 'columns' })
1369
+ Panel ._setup_axes (axes = ['items' , 'major_axis' , 'minor_axis' ],
1370
+ info_axis = 0 ,
1371
+ stat_axis = 1 ,
1372
+ aliases = { 'major' : 'major_axis' ,
1373
+ 'minor' : 'minor_axis' },
1374
+ slicers = { 'major_axis' : 'index' ,
1375
+ 'minor_axis' : 'columns' })
1374
1376
Panel ._add_aggregate_operations ()
1375
1377
1376
1378
WidePanel = Panel
@@ -1386,7 +1388,7 @@ def install_ipython_completers(): # pragma: no cover
1386
1388
def complete_dataframe (obj , prev_completions ):
1387
1389
return prev_completions + [c for c in obj .keys ()
1388
1390
if isinstance (c , basestring )
1389
- and py3compat .isidentifier (c )]
1391
+ and py3compat .isidentifier (c )]
1390
1392
1391
1393
# Importing IPython brings in about 200 modules, so we want to avoid it unless
1392
1394
# we're in IPython (when those modules are loaded anyway).
0 commit comments