text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>pandas.Panel — pandas 0.24.0.dev0+81.g8d5032a8c.dirty documentation</title>
    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="pandas.Panel.at" href="pandas.Panel.at.html" />
    <link rel="prev" title="pandas.SparseDataFrame.to_coo" href="pandas.SparseDataFrame.to_coo.html" />

Navigation

          index

          modules |

          next |

          previous |

pandas 0.24.0.dev0+81.g8d5032a8c.dirty documentation »

API Reference »

Table Of Contents

What's New

Installation

Contributing to pandas

Package overview

10 Minutes to pandas

Tutorials

Cookbook

Intro to Data Structures

Essential Basic Functionality

Working with Text Data

Options and Settings

Indexing and Selecting Data

MultiIndex / Advanced Indexing

Computational tools

Working with missing data

Group By: split-apply-combine

Merge, join, and concatenate

Reshaping and Pivot Tables

Time Series / Date functionality

Time Deltas

Categorical Data

Visualization

Styling

IO Tools (Text, CSV, HDF5, …)

Enhancing Performance

Sparse data structures

Frequently Asked Questions (FAQ)

rpy2 / R interface

pandas Ecosystem

Comparison with R / R libraries

Comparison with SQL

Comparison with SAS

Comparison with Stata

API Reference

Input/Output

General functions

Series

DataFrame

Panel

Constructor

pandas.Panel

Attributes and underlying data

Conversion

Getting and setting

Indexing, iteration, slicing

Binary operator functions

Function application, GroupBy

Computations / Descriptive Stats

Reindexing / Selection / Label manipulation

Missing data handling

Reshaping, sorting, transposing

Combining / joining / merging

Time series-related

Serialization / IO / Conversion

Index

Numeric Index

CategoricalIndex

IntervalIndex

MultiIndex

DatetimeIndex

TimedeltaIndex

PeriodIndex

Scalars

Frequencies

Window

GroupBy

Resampling

Style

Plotting

General utility functions

Extensions

Developer

Internals

Extending Pandas

Release Notes

Search

                <form class="search" action="../search.html" method="get">
                    <input type="text" name="q" size="18"/>
                    <input type="submit" value="Go"/>
                    <input type="hidden" name="check_keywords" value="yes"/>
                    <input type="hidden" name="area" value="default"/>
                </form>

                    Enter search terms or a module, class or function name.

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 a to_xarray() method to automate this
conversion.

<col class="field-name" />
<col class="field-body" />

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

<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>

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.

<colgroup>
<col width="52%" />
<col width="48%" />
</colgroup>

is_copy

Methods

<colgroup>
<col width="10%" />
<col width="90%" />
</colgroup>

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

<colgroup>
<col width="57%" />
<col width="43%" />
</colgroup>

agg

aggregate

drop

Navigation

          index

          modules |

          next |

          previous |

pandas 0.24.0.dev0+81.g8d5032a8c.dirty documentation »

API Reference »

Scroll To Top


text:
package org.microbule.version.decorator;

import javax.inject.Named;
import javax.inject.Singleton;

import org.microbule.config.api.Config;
import org.microbule.spi.JaxrsServerDecorator;
import org.microbule.spi.JaxrsServiceDescriptor;

@Named("versionDecorator")
@Singleton
public class VersionDecorator implements JaxrsServerDecorator {
//----------------------------------------------------------------------------------------------------------------------
// JaxrsServiceDecorator Implementation
//----------------------------------------------------------------------------------------------------------------------

    @Override
    public void decorate(JaxrsServiceDescriptor descriptor, Config config) {
        descriptor.addProvider(new VersionRequestFilter(new VersionResponse(descriptor.serviceInterface())));
    }

    @Override
    public String name() {
        return "version";
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.activemq.artemis.jms.example;

import java.nio.charset.StandardCharsets;

import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
import javax.jms.Queue;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.jms.XAConnection;
import javax.jms.XAConnectionFactory;
import javax.jms.XASession;
import javax.naming.InitialContext;
import javax.transaction.xa.XAResource;
import javax.transaction.xa.Xid;

import org.apache.activemq.artemis.common.example.DummyXid;
import org.apache.activemq.artemis.common.example.ActiveMQExample;
import org.apache.activemq.artemis.utils.UUIDGenerator;

/**
 * A simple JMS example showing the usage of XA support in JMS.
 */
public class XAReceiveExample extends ActiveMQExample
{
   private volatile boolean result = true;

   public static void main(final String[] args)
   {
      new XAReceiveExample().run(args);
   }

   @Override
   public boolean runExample() throws Exception
   {
      XAConnection connection = null;
      InitialContext initialContext = null;
      try
      {
         // Step 1. Create an initial context to perform the JNDI lookup.
         initialContext = new InitialContext();

         // Step 2. Lookup on the queue
         Queue queue = (Queue)initialContext.lookup("queue/exampleQueue");

         // Step 3. Perform a lookup on the XA Connection Factory
         XAConnectionFactory cf = (XAConnectionFactory)initialContext.lookup("XAConnectionFactory");

         // Step 4.Create a JMS XAConnection
         connection = cf.createXAConnection();

         // Step 5. Start the connection
         connection.start();

         // Step 6. Create a JMS XASession
         XASession xaSession = connection.createXASession();

         // Step 7. Create a normal session
         Session normalSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);

         // Step 8. Create a normal Message Producer
         MessageProducer normalProducer = normalSession.createProducer(queue);

         // Step 9. Get the JMS Session
         Session session = xaSession.getSession();

         // Step 10. Create a message consumer
         MessageConsumer xaConsumer = session.createConsumer(queue);

         // Step 11. Create two Text Messages
         TextMessage helloMessage = session.createTextMessage("hello");
         TextMessage worldMessage = session.createTextMessage("world");

         // Step 12. create a transaction
         Xid xid1 =
                  new DummyXid("xa-example1".getBytes(StandardCharsets.US_ASCII), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 13. Get the JMS XAResource
         XAResource xaRes = xaSession.getXAResource();

         // Step 14. Begin the Transaction work
         xaRes.start(xid1, XAResource.TMNOFLAGS);

         // Step 15. Send two messages.
         normalProducer.send(helloMessage);
         normalProducer.send(worldMessage);

         // Step 16. Receive the message
         TextMessage rm1 = (TextMessage)xaConsumer.receive();
         System.out.println("Message received: " + rm1.getText());
         TextMessage rm2 = (TextMessage)xaConsumer.receive();
         System.out.println("Message received: " + rm2.getText());

         // Step 17. Stop the work
         xaRes.end(xid1, XAResource.TMSUCCESS);

         // Step 18. Prepare
         xaRes.prepare(xid1);

         // Step 19. Roll back the transaction
         xaRes.rollback(xid1);

         // Step 20. Create another transaction
         Xid xid2 = new DummyXid("xa-example2".getBytes(), 1, UUIDGenerator.getInstance()
                                                                           .generateStringUUID()
                                                                           .getBytes());

         // Step 21. Start the transaction
         xaRes.start(xid2, XAResource.TMNOFLAGS);

         // Step 22. receive those messages again
         rm1 = (TextMessage)xaConsumer.receive();
         System.out.println("Message received again: " + rm1.getText());
         rm2 = (TextMessage)xaConsumer.receive();
         System.out.println("Message received again: " + rm2.getText());

         // Step 23. Stop the work
         xaRes.end(xid2, XAResource.TMSUCCESS);

         // Step 24. Prepare
         xaRes.prepare(xid2);

         // Step 25. Commit!
         xaRes.commit(xid2, false);

         // Step 26. Check no more messages are received.
         TextMessage rm3 = (TextMessage)xaConsumer.receive(2000);
         if (rm3 == null)
         {
            System.out.println("No message received after commit.");
         }
         else
         {
            result = false;
         }

         return result;
      }
      finally
      {
         // Step 27. Be sure to close our JMS resources!
         if (initialContext != null)
         {
            initialContext.close();
         }
         if (connection != null)
         {
            connection.close();
         }
      }
   }

}