Table#

class Table(*args, **kwargs)[source]#

Wrapper for the vtkTable class.

Create by passing a 2D NumPy array of shape (n_rows by n_columns) or from a dictionary containing NumPy arrays.

Parameters:
*argsvtkTable, numpy.ndarray, dict, pandas.DataFrame, optional

Data source used to initialize the table.

deepbool, default: True

Deep copy the input when initializing from a vtkTable.

**kwargsdict, optional

Unused.

Deprecated since version 0.49: These arguments have never had any effect and will be removed.

Examples#

Download Python source code | Download Jupyter notebook

>>> import pyvista as pv
>>> import numpy as np
>>> arrays = np.random.default_rng().random((100, 3))
>>> table = pv.Table(arrays)

Inheritance#

Inherited members are documented on DataObject.

See them all under Inherited Attributes and Inherited Methods.

Wraps vtkTable.

Attributes#

Table.is_empty

Return True if the table has no rows and no columns.

Table.n_arrays

Return the number of columns.

Table.n_columns

Return the number of columns.

Table.n_rows

Return the number of rows.

Table.row_arrays

Return the all row arrays.

Inherited Attributes#

DataObject.actual_memory_size

Return the actual size of the dataset object.

DataObject.field_data

Return FieldData as DataSetAttributes.

DataObject.memory_address

Get address of the underlying VTK C++ object.

DataObject.user_dict

Set or return a user-specified data dictionary.

Methods#

Table.get(index)

Get an array by its name.

Table.get_data_range([arr, preference])

Get the min and max of a named array.

Table.items()

Return the table items.

Table.keys()

Return the table keys.

Table.pop(name)

Pop off an array by the specified name.

Table.save(*args, **kwargs)

Save the table.

Table.to_arrow()

Return this table as a pyarrow.Table.

Table.to_pandas()

Create a Pandas DataFrame from this Table.

Table.update(data)

Set the table data using a dict-like update.

Table.values()

Return the table values.

Inherited Methods#

DataObject.add_field_data

Add field data.

DataObject.cast_to_multiblock

Convert this DataObject to a MultiBlock.

DataObject.clear_field_data

Remove all field data.

DataObject.copy

Return a copy of the object.

DataObject.copy_attributes

Copy the data attributes of the input dataset object.

DataObject.copy_meta_from

Copy pyvista meta data onto this object from another object.

DataObject.copy_structure

Copy the structure (geometry and topology) of the input dataset object.

DataObject.deep_copy

Overwrite this data object with another data object as a deep copy.

DataObject.head

Return the header stats of this dataset.

DataObject.shallow_copy

Shallow copy the given mesh to this mesh.