pandas.Panel¶
-
class
pandas.
Panel
(data=None, items=None, major_axis=None, minor_axis=None, copy=False, dtype=None)[source]¶ - Represents wide format panel data, stored as 3-dimensional array
Deprecated since version 0.20.0: The recommended way to represent 3-D data are with a MultiIndex on a DataFrame via the
to_frame()
method or with the xarray package. Pandas provides ato_xarray()
method to automate this conversion.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
Access a single value for a row/column label pair. axes
Return index label(s) of the internal NDFrame blocks
(DEPRECATED) Internal property, property synonym for as_blocks() dtypes
Return the dtypes in the DataFrame. empty
Indicator whether DataFrame is empty. ftypes
Return the ftypes (indication of sparse/dense and dtype) in DataFrame. iat
Access a single value for a row/column pair by integer position. iloc
Purely integer-location based indexing for selection by position. items
ix
A primarily label-location based indexer, with integer position fallback. loc
Access a group of rows and columns by label(s) or a boolean array. major_axis
minor_axis
ndim
Return an int representing the number of axes / array dimensions. shape
Return a tuple of axis dimensions size
Return an int representing the number of elements in this object. values
Return a Numpy representation of the DataFrame. is_copy Methods
abs
()Return a Series/DataFrame with absolute numeric value of each element. add
(other[, axis])Addition of series and other, element-wise (binary operator add). add_prefix
(prefix)Prefix labels with string prefix. add_suffix
(suffix)Suffix labels with string suffix. align
(other, **kwargs)Align two objects on their axes with the specified join method for each axis Index all
([axis, bool_only, skipna, level])Return whether all elements are True over series or dataframe axis. any
([axis, bool_only, skipna, level])Return whether any element is True over requested axis. apply
(func[, axis])Applies function along axis (or axes) of the Panel as_blocks
([copy])(DEPRECATED) Convert the frame to a dict of dtype -> Constructor Types that each has a homogeneous dtype. as_matrix
()Convert the frame to its Numpy-array representation. asfreq
(freq[, method, how, normalize, …])Convert TimeSeries to specified frequency. asof
(where[, subset])The last row without any NaN is taken (or the last row without NaN considering only the subset of columns in the case of a DataFrame) astype
(dtype[, copy, errors])Cast a pandas object to a specified dtype 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 DataFrame.fillna(method='bfill')
bool
()Return the bool of a single element PandasObject. clip
([lower, upper, axis, inplace])Trim values at input threshold(s). clip_lower
(threshold[, axis, inplace])Return copy of the input with values below a threshold truncated. clip_upper
(threshold[, axis, inplace])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])(DEPRECATED) Compute NDFrame with “consolidated” internals (data of each dtype grouped together in a single ndarray). convert_objects
([convert_dates, …])(DEPRECATED) Attempt to infer better dtype for object columns. copy
([deep])Make a copy of this object’s indices and data. count
([axis])Return number of observations over requested axis. cummax
([axis, skipna])Return cumulative maximum over a DataFrame or Series axis. cummin
([axis, skipna])Return cumulative minimum over a DataFrame or Series axis. cumprod
([axis, skipna])Return cumulative product over a DataFrame or Series axis. cumsum
([axis, skipna])Return cumulative sum over a DataFrame or Series axis. describe
([percentiles, include, exclude])Generates descriptive statistics that summarize the central tendency, dispersion and shape of a dataset’s distribution, 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). dropna
([axis, how, inplace])Drop 2D from panel, holding passed axis constant eq
(other[, axis])Wrapper for comparison method eq equals
(other)Determines if two NDFrame objects contain the same elements. ffill
([axis, inplace, limit, downcast])Synonym for DataFrame.fillna(method='ffill')
fillna
([value, method, axis, inplace, …])Fill NA/NaN values using the specified method filter
([items, like, regex, axis])Subset rows or columns of dataframe according to labels in the specified index. first
(offset)Convenience method for subsetting initial periods of time series data based on a date offset. first_valid_index
()Return index for first non-NA/null value. 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[, axis])Wrapper for comparison method ge get
(key[, default])Get item from object for given key (DataFrame column, Panel slice, etc.). get_dtype_counts
()Return counts of unique dtypes in this object. get_ftype_counts
()(DEPRECATED) Return counts of unique ftypes in this object. get_value
(*args, **kwargs)(DEPRECATED) Quickly retrieve single value at (item, major, minor) location get_values
()Return an ndarray after converting sparse values to dense. groupby
(function[, axis])Group data on given axis, returning GroupBy object gt
(other[, axis])Wrapper for comparison method gt head
([n])Return the first n rows. infer_objects
()Attempt to infer better dtypes for object columns. interpolate
([method, axis, limit, inplace, …])Interpolate values according to different methods. isna
()Detect missing values. isnull
()Detect missing values. iteritems
()Iterate over (label, values) on info axis 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 Fisher’s definition of kurtosis (kurtosis of normal == 0.0). kurtosis
([axis, skipna, level, numeric_only])Return unbiased kurtosis over requested axis using Fisher’s definition of kurtosis (kurtosis of normal == 0.0). last
(offset)Convenience method for subsetting final periods of time series data based on a date offset. last_valid_index
()Return index for last non-NA/null value. le
(other[, axis])Wrapper for comparison method le lt
(other[, axis])Wrapper for comparison method lt mad
([axis, skipna, level])Return the mean absolute deviation of the values for the requested axis major_xs
(key)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)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[, axis])Wrapper for comparison method ne notna
()Detect existing (non-missing) values. notnull
()Detect existing (non-missing) values. pct_change
([periods, fill_method, limit, freq])Percentage change between the current and a prior element. 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). rank
([axis, method, numeric_only, …])Compute numerical data ranks (1 through n) along axis. rdiv
(other[, axis])Floating division of series and other, element-wise (binary operator rtruediv). reindex
(*args, **kwargs)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 indices to myself. rename
([items, major_axis, minor_axis])Alter axes input function or functions. rename_axis
(mapper[, axis, copy, inplace])Alter the name of the index or columns. 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 time series. 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). round
([decimals])Round each value in Panel to a specified number of decimal places. 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, …])Return a random sample of items from an axis of object. select
(crit[, axis])(DEPRECATED) 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
(labels[, axis, inplace])Assign desired index to given axis. set_value
(*args, **kwargs)(DEPRECATED) Quickly set single value at (item, major, minor) location shift
([periods, freq, axis])Shift index by desired number of periods with an optional time freq. skew
([axis, skipna, level, numeric_only])Return unbiased skew over requested axis Normalized by N-1 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, …])NOT IMPLEMENTED: do not call this method, as sorting values is not supported for Panel objects and will raise an error. squeeze
([axis])Squeeze length 1 dimensions. std
([axis, skipna, level, ddof, numeric_only])Return sample 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])Return the last n rows. take
(indices[, axis, convert, is_copy])Return the elements in the given positional indices along an axis. to_clipboard
([excel, sep])Copy object to the system clipboard. 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)Write the contained data to an HDF5 file using HDFStore. to_json
([path_or_buf, orient, date_format, …])Convert the object to a JSON string. to_latex
([buf, columns, col_space, header, …])Render an object to a tabular environment table. to_msgpack
([path_or_buf, encoding])msgpack (serialize) object to input file path to_pickle
(path[, compression, protocol])Pickle (serialize) object to file. to_sparse
(*args, **kwargs)NOT IMPLEMENTED: do not call this method, as sparsifying is not supported for Panel objects and will raise an error. to_sql
(name, con[, schema, if_exists, …])Write records stored in a DataFrame to a SQL database. to_xarray
()Return an xarray object from the pandas object. 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])Truncate a Series or DataFrame before and after some index value. tshift
([periods, freq, axis])Shift the time index, using the index’s frequency if available. tz_convert
(tz[, axis, level, copy])Convert tz-aware axis to target time zone. tz_localize
(tz[, axis, level, copy, ambiguous])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])Return slice of panel along selected axis agg aggregate drop