Package picalo :: Module Crosstable :: Class Crosstabler
[show private | hide private]
[frames | no frames]

Class Crosstabler


Crosstables data sets. This is similar to Excel's PivotTable feature, although somewhat more powerful (although admittedly harder to use).

The Crosstable object is not normally used directly. The pivot, pivot_source, and pivot_map functions should be used instead.

The Crosstable object is live, meaning that it calculates results just in time. Any changes to the table are reflected immediately.
Method Summary
  __init__(self, table, row_fields, col_fields, expressions)
Sets up the crosstable.
  get_cell_calculations(self, rowlabel, collabel)
Returns the cell calculations for the cell with the given row label unique value and column label unique value
  get_cell_records(self, rowlabel, collabel)
Returns the records that match the given rowlabel and collabel unique values
  get_col_calculations(self, collabel)
Returns the cell calculations for the col with the given row label
  get_col_labels(self)
Returns the unique labels for the column names.
  get_col_records(self, collabel)
Returns the records that match the given collabel unique value
  get_row_calculations(self, rowlabel)
Returns the cell calculations for the row with the given row label
  get_row_labels(self)
Returns the unique labels for the column names.
  get_row_records(self, rowlabel)
Returns the records that match the given rowlabel unique value
  get_table_calculations(self)
Returns the grand total calculations for the entire table

Method Details

__init__(self, table, row_fields, col_fields, expressions)
(Constructor)

Sets up the crosstable. Don't use this object directly. Call pivot, pivot_source, and pivot_map instead.
Parameters:
table - the source Picalo table (list of rows (which are lists themselves))
           (type=Table)
row_fields - a list containing the field names of the fields used to group rows
           (type=list)
col_fields - a list containing the field names of the fields used to group columns
           (type=list)
expressions - a list containing expressions for groupings; for each matching col/row value, each expression is run with the matching records in the "group" variable.
           (type=list)

get_cell_calculations(self, rowlabel, collabel)

Returns the cell calculations for the cell with the given row label unique value and column label unique value

get_cell_records(self, rowlabel, collabel)

Returns the records that match the given rowlabel and collabel unique values

get_col_calculations(self, collabel)

Returns the cell calculations for the col with the given row label

get_col_labels(self)

Returns the unique labels for the column names. If col_fields was a single value, the labels are single values. If col_fields was a list of values, the labels are tuples of values.

get_col_records(self, collabel)

Returns the records that match the given collabel unique value

get_row_calculations(self, rowlabel)

Returns the cell calculations for the row with the given row label

get_row_labels(self)

Returns the unique labels for the column names. If row_fields was a single value, the labels are single values. If row_fields was a list of values, the labels are tuples of values.

get_row_records(self, rowlabel)

Returns the records that match the given rowlabel unique value

get_table_calculations(self)

Returns the grand total calculations for the entire table

Generated by Epydoc 2.1 on Mon Aug 20 05:38:17 2007 http://epydoc.sf.net