pandas.Panel¶
- class pandas.Panel(data=None, items=None, major_axis=None, minor_axis=None, copy=False, dtype=None)¶
Represents wide format panel data, stored as 3-dimensional array
Parameters: data : ndarray (items x major x minor), or dict of DataFrames
items : Index or array-like
axis=0
major_axis : Index or array-like
axis=1
minor_axis : Index or array-like
axis=2
dtype : dtype, default None
Data type to force, otherwise infer
copy : boolean, default False
Copy data from inputs. Only affects DataFrame / 2d ndarray input
Attributes
at Fast label-based scalar accessor axes Return index label(s) of the internal NDFrame blocks Internal property, property synonym for as_blocks() dtypes Return the dtypes in this object empty True if NDFrame is entirely empty [no items] ftypes Return the ftypes (indication of sparse/dense and dtype) in this object. iat Fast integer location scalar accessor. iloc Purely integer-location based indexing for selection by position. is_copy ix A primarily label-location based indexer, with integer position fallback. loc Purely label-location based indexer for selection by label. ndim Number of axes / array dimensions shape Return a tuple of axis dimensions size number of elements in the NDFrame values Numpy representation of NDFrame Methods
abs() Return an object with absolute value taken. add(other[, axis]) Addition of series and other, element-wise (binary operator add). add_prefix(prefix) Concatenate prefix string with panel items names. add_suffix(suffix) Concatenate suffix string with panel items names align(other, **kwargs) all([axis, bool_only, skipna, level]) Return whether all elements are True over requested axis any([axis, bool_only, skipna, level]) Return whether any element is True over requested axis apply(func[, axis]) Applies function along input axis of the Panel as_blocks([copy]) Convert the frame to a dict of dtype -> Constructor Types that each has a homogeneous dtype. as_matrix() asfreq(freq[, method, how, normalize]) Convert all TimeSeries inside to specified frequency using DateOffset objects. astype(dtype[, copy, raise_on_error]) Cast object to input numpy.dtype at_time(time[, asof]) Select values at particular time of day (e.g. between_time(start_time, end_time[, ...]) Select values between particular times of the day (e.g., 9:00-9:30 AM) bfill([axis, inplace, limit, downcast]) Synonym for NDFrame.fillna(method=’bfill’) bool() Return the bool of a single element PandasObject clip([lower, upper, out, axis]) Trim values at input threshold(s) clip_lower(threshold[, axis]) Return copy of the input with values below given value(s) truncated clip_upper(threshold[, axis]) Return copy of input with values above given value(s) truncated compound([axis, skipna, level]) Return the compound percentage of the values for the requested axis conform(frame[, axis]) Conform input DataFrame to align with chosen axis pair. consolidate([inplace]) Compute NDFrame with “consolidated” internals (data of each dtype grouped together in a single ndarray). convert_objects([convert_dates, ...]) Attempt to infer better dtype for object columns copy([deep]) Make a copy of this object count([axis]) Return number of observations over requested axis. cummax([axis, dtype, out, skipna]) Return cumulative max over requested axis. cummin([axis, dtype, out, skipna]) Return cumulative min over requested axis. cumprod([axis, dtype, out, skipna]) Return cumulative prod over requested axis. cumsum([axis, dtype, out, skipna]) Return cumulative sum over requested axis. describe([percentiles, include, exclude]) Generate various summary statistics, excluding NaN values. div(other[, axis]) Floating division of series and other, element-wise (binary operator truediv). divide(other[, axis]) Floating division of series and other, element-wise (binary operator truediv). drop(labels[, axis, level, inplace, errors]) Return new object with labels in requested axis removed dropna([axis, how, inplace]) Drop 2D from panel, holding passed axis constant eq(other) Wrapper for comparison method eq equals(other) Determines if two NDFrame objects contain the same elements. ffill([axis, inplace, limit, downcast]) Synonym for NDFrame.fillna(method=’ffill’) fillna([value, method, axis, inplace, ...]) Fill NA/NaN values using the specified method filter([items, like, regex, axis]) Restrict the info axis to set of items or wildcard first(offset) Convenience method for subsetting initial periods of time series data floordiv(other[, axis]) Integer division of series and other, element-wise (binary operator floordiv). fromDict(data[, intersect, orient, dtype]) Construct Panel from dict of DataFrame objects from_dict(data[, intersect, orient, dtype]) Construct Panel from dict of DataFrame objects ge(other) Wrapper for comparison method ge get(key[, default]) Get item from object for given key (DataFrame column, Panel slice, etc.). get_dtype_counts() Return the counts of dtypes in this object get_ftype_counts() Return the counts of ftypes in this object get_value(*args, **kwargs) Quickly retrieve single value at (item, major, minor) location get_values() same as values (but handles sparseness conversions) groupby(function[, axis]) Group data on given axis, returning GroupBy object gt(other) Wrapper for comparison method gt head([n]) interpolate([method, axis, limit, inplace, ...]) Interpolate values according to different methods. isnull() Return a boolean same-sized object indicating if the values are null iteritems() Iterate over (label, values) on info axis iterkv(*args, **kwargs) iteritems alias used to get around 2to3. Deprecated join(other[, how, lsuffix, rsuffix]) Join items with other Panel either on major and minor axes column keys() Get the ‘info axis’ (see Indexing for more) kurt([axis, skipna, level, numeric_only]) Return unbiased kurtosis over requested axis using Fishers definition of kurtosis (kurtosis of normal == 0.0). kurtosis([axis, skipna, level, numeric_only]) Return unbiased kurtosis over requested axis using Fishers definition of kurtosis (kurtosis of normal == 0.0). last(offset) Convenience method for subsetting final periods of time series data le(other) Wrapper for comparison method le lt(other) Wrapper for comparison method lt mad([axis, skipna, level]) Return the mean absolute deviation of the values for the requested axis major_xs(key[, copy]) Return slice of panel along major axis mask(cond[, other, inplace, axis, level, ...]) Return an object of same shape as self and whose corresponding entries are from self where cond is False and otherwise are from other. max([axis, skipna, level, numeric_only]) This method returns the maximum of the values in the object. mean([axis, skipna, level, numeric_only]) Return the mean of the values for the requested axis median([axis, skipna, level, numeric_only]) Return the median of the values for the requested axis min([axis, skipna, level, numeric_only]) This method returns the minimum of the values in the object. minor_xs(key[, copy]) Return slice of panel along minor axis mod(other[, axis]) Modulo of series and other, element-wise (binary operator mod). mul(other[, axis]) Multiplication of series and other, element-wise (binary operator mul). multiply(other[, axis]) Multiplication of series and other, element-wise (binary operator mul). ne(other) Wrapper for comparison method ne notnull() Return a boolean same-sized object indicating if the values are pct_change([periods, fill_method, limit, freq]) Percent change over given number of periods. pipe(func, *args, **kwargs) Apply func(self, *args, **kwargs) pop(item) Return item and drop from frame. pow(other[, axis]) Exponential power of series and other, element-wise (binary operator pow). prod([axis, skipna, level, numeric_only]) Return the product of the values for the requested axis product([axis, skipna, level, numeric_only]) Return the product of the values for the requested axis radd(other[, axis]) Addition of series and other, element-wise (binary operator radd). rdiv(other[, axis]) Floating division of series and other, element-wise (binary operator rtruediv). reindex([items, major_axis, minor_axis]) Conform Panel to new index with optional filling logic, placing NA/NaN in locations having no value in the previous index. reindex_axis(labels[, axis, method, level, ...]) Conform input object to new index with optional filling logic, placing NA/NaN in locations having no value in the previous index. reindex_like(other[, method, copy, limit, ...]) return an object with matching indicies to myself rename([items, major_axis, minor_axis]) Alter axes input function or functions. rename_axis(mapper[, axis, copy, inplace]) Alter index and / or columns using input function or functions. replace([to_replace, value, inplace, limit, ...]) Replace values given in ‘to_replace’ with ‘value’. resample(rule[, how, axis, fill_method, ...]) Convenience method for frequency conversion and resampling of regular time-series data. rfloordiv(other[, axis]) Integer division of series and other, element-wise (binary operator rfloordiv). rmod(other[, axis]) Modulo of series and other, element-wise (binary operator rmod). rmul(other[, axis]) Multiplication of series and other, element-wise (binary operator rmul). rpow(other[, axis]) Exponential power of series and other, element-wise (binary operator rpow). rsub(other[, axis]) Subtraction of series and other, element-wise (binary operator rsub). rtruediv(other[, axis]) Floating division of series and other, element-wise (binary operator rtruediv). sample([n, frac, replace, weights, ...]) Returns a random sample of items from an axis of object. select(crit[, axis]) Return data corresponding to axis labels matching criteria sem([axis, skipna, level, ddof, numeric_only]) Return unbiased standard error of the mean over requested axis. set_axis(axis, labels) public verson of axis assignment set_value(*args, **kwargs) Quickly set single value at (item, major, minor) location shift(*args, **kwargs) Shift index by desired number of periods with an optional time freq. skew([axis, skipna, level, numeric_only]) Return unbiased skew over requested axis slice_shift([periods, axis]) Equivalent to shift without copying data. sort_index([axis, level, ascending, ...]) Sort object by labels (along an axis) sort_values(by[, axis, ascending, inplace, ...]) squeeze() squeeze length 1 dimensions std([axis, skipna, level, ddof, numeric_only]) Return unbiased standard deviation over requested axis. sub(other[, axis]) Subtraction of series and other, element-wise (binary operator sub). subtract(other[, axis]) Subtraction of series and other, element-wise (binary operator sub). sum([axis, skipna, level, numeric_only]) Return the sum of the values for the requested axis swapaxes(axis1, axis2[, copy]) Interchange axes and swap values axes appropriately swaplevel(i, j[, axis]) Swap levels i and j in a MultiIndex on a particular axis tail([n]) take(indices[, axis, convert, is_copy]) Analogous to ndarray.take toLong(*args, **kwargs) to_clipboard([excel, sep]) Attempt to write text representation of object to the system clipboard This can be pasted into Excel, for example. to_dense() Return dense representation of NDFrame (as opposed to sparse) to_excel(path[, na_rep, engine]) Write each DataFrame in Panel to a separate excel sheet to_frame([filter_observations]) Transform wide format into long (stacked) format as DataFrame whose columns are the Panel’s items and whose index is a MultiIndex formed of the Panel’s major and minor axes. to_hdf(path_or_buf, key, **kwargs) activate the HDFStore to_json([path_or_buf, orient, date_format, ...]) Convert the object to a JSON string. to_long(*args, **kwargs) to_msgpack([path_or_buf]) msgpack (serialize) object to input file path to_pickle(path) Pickle (serialize) object to input file path to_sparse([fill_value, kind]) Convert to SparsePanel to_sql(name, con[, flavor, schema, ...]) Write records stored in a DataFrame to a SQL database. transpose(*args, **kwargs) Permute the dimensions of the Panel truediv(other[, axis]) Floating division of series and other, element-wise (binary operator truediv). truncate([before, after, axis, copy]) Truncates a sorted NDFrame before and/or after some particular dates. tshift([periods, freq, axis]) tz_convert(tz[, axis, level, copy]) Convert tz-aware axis to target time zone. tz_localize(*args, **kwargs) Localize tz-naive TimeSeries to target time zone update(other[, join, overwrite, ...]) Modify Panel in place using non-NA values from passed Panel, or object coercible to Panel. var([axis, skipna, level, ddof, numeric_only]) Return unbiased variance over requested axis. where(cond[, other, inplace, axis, level, ...]) Return an object of same shape as self and whose corresponding entries are from self where cond is True and otherwise are from other. xs(key[, axis, copy]) Return slice of panel along selected axis