represent_nd_columns_as_1d_columns#

astropy.table.represent_nd_columns_as_1d_columns(tbl, copy=False)[source]#

Represent any N-D columns in a table as multiple 1-D columns.

This function represents (or “flattens”) any N-D columns in tbl as multiple 1-D Column objects and returns a new Table.

The schema for transforming N-D to multiple 1-D is to create new column names by appending the indices of the N-D column to the original column name, separated by a dot. For example, a 2-D column named data with shape (3, 4) would be represented as 12 1-D columns named data.0_0, data.0_1, …, data.2_3.

If any of these new column names conflict with existing column names, underscores are appended to the base name until the conflict is resolved. For example, if a column named data.0_0 already exists, the new column would be named data_.0_0. If that also exists, the new column would be named data__.0_0, and so on.

Parameters:
tblTable

Table to flatten.

copybool, optional

If True, always return a copy of the table. If False, return a copy only if the table has N-D columns. Default is False.

Returns:
outTable

Flattened table.