Tables (datascience.tables)

Summary of methods for Table. Click a method to see its documentation.

One note about reading the method signatures for this page: each method is listed with its arguments. However, optional arguments are specified in brackets. That is, a method that’s documented like (first_arg, second_arg[, some_other_arg, fourth_arg])

means that the method must be called with first_arg and second_arg and optionally some_other_arg and fourth_arg. That means the following are valid ways to call, 2), 2, 'hello'), 2, 'hello', 'world'), 2, some_other_arg='hello')

But these are not valid: # Missing arg, 2[, 'hi']) # SyntaxError, 2[, 'hello', 'world']) # SyntaxError

If that syntax is confusing, you can click the method name itself to get to the details page for that method. That page will have a more straightforward syntax.

At the time of this writing, most methods only have one or two sentences of documentation, so what you see here is all that you’ll get for the time being. We are actively working on documentation, prioritizing the most complicated methods (mostly visualizations).


Table.__init__([labels, formatter])

Create an empty table with column labels.


Creates an empty table.


Create a table from a sequence of records (dicts with fixed keys).


Create a table from a mapping of column labels to column values.

Table.read_table(filepath_or_buffer, *args, …)

Read a table from a file or web address.

Table.from_df(df[, keep_index])

Convert a Pandas DataFrame into a Table.


Convert a structured NumPy array into a Table.

Extension (does not modify original table)

Table.with_column(label, values[, formatter])

Return a new table with an additional or replaced column.

Table.with_columns(*labels_and_values, …)

Return a table with additional or replaced columns.


Return a table with an additional row.


Return a table with additional rows.

Table.relabeled(label, new_label)

Return a new table with label specifying column label(s) replaced by corresponding new_label.

Accessing values


Number of columns.


Return a tuple of columns, each with the values in that column.


Return the values of a column as an array.


Number of rows.


Return a view of all rows.


Return a row.


Return a tuple of column labels.


Return the zeroth item in a column.


Return the last item in a column.


Return the index of a column by looking up its label.

Table.apply(fn, *column_or_columns)

Apply fn to each element or elements of column_or_columns.

Mutation (modifies table in place)

Table.set_format(column_or_columns, formatter)

Set the format of a column.


Move a column to the first in order.


Move a column to the last in order.


Append a row or all rows of a table.

Table.append_column(label, values[, formatter])

Appends a column to the table or replaces a column.

Table.relabel(column_label, new_label)

Changes the label(s) of column(s) specified by column_label to labels in new_label.


Removes a row or multiple rows of a table in place.

Transformation (creates a new table)

Table.copy(*[, shallow])

Return a copy of a table.*column_or_columns)

Return a table with only the columns in column_or_columns.


Return a Table with only columns other than selected label or labels.


Return a new Table with selected rows taken by index.


Return a new Table without a sequence of rows excluded by number.

Table.move_column(label, index)

Returns a new table with specified column moved to the specified column index.

Table.where(column_or_label[, …])

Return a new Table containing rows where value_or_predicate returns True for values in column_or_label.

Table.sort(column_or_label[, descending, …])

Return a Table of rows sorted according to the values in a column.[, collect])

Group rows by unique values in a column; count or aggregate others.

Table.groups(labels[, collect])

Group rows by multiple columns, count or aggregate others.

Table.pivot(columns, rows[, values, …])

Generate a table with a column for each unique value in columns, with rows for each unique value in rows.

Table.stack(key[, labels])

Takes k original columns and returns two columns, with col.

Table.join(column_label, other[, other_label])

Creates a new table with the columns of self and other, containing rows for all values of a column that appear in both tables.


Compute statistics for each column and place them in a table.


Return a new table with one row containing the pth percentile for each column.

Table.sample([k, with_replacement, weights])

Return a new table where k rows are randomly sampled from the original table.


Return a new table where all the rows are randomly shuffled from the original table..

Table.sample_from_distribution(distribution, k)

Return a new table with the same number of rows and a new column.


Return a tuple of two tables where the first table contains k rows randomly sampled and the second contains the remaining rows.

Table.bin(*columns, **vargs)

Group values by bin and compute counts per bin by column.

Table.pivot_bin(pivot_columns, value_column)

Form a table with columns formed by the unique tuples in pivot_columns containing counts per bin of the values associated with each tuple in the value_column.

Exporting / Displaying[max_rows])

Display the table.

Table.as_text([max_rows, sep])

Format table as text.


Format table as HTML.


Return a dict keyed by values in a column that contains lists of rows corresponding to each value.


Convert the table to a structured NumPy array.


Convert the table to a Pandas DataFrame.


Creates a CSV file with the provided filename.


Table.plot([column_for_xticks, select, …])

Plot line charts for the table.[column_for_categories, select, …])

Plot bar charts for the table.

Table.group_bar(column_label, **vargs)

Plot a bar chart for the table.

Table.barh([column_for_categories, select, …])

Plot horizontal bar charts for the table.

Table.group_barh(column_label, **vargs)

Plot a horizontal bar chart for the table.

Table.pivot_hist(pivot_column_label, …[, …])

Draw histograms of each category in a column.

Table.hist(*columns[, overlay, bins, …])

Plots one histogram for each column in columns.

Table.hist_of_counts(*columns[, overlay, …])

Plots one count-based histogram for each column in columns.

Table.scatter(column_for_x[, select, …])

Creates scatterplots, optionally adding a line of best fit.


Plots a boxplot for the table.