![]() ![]() Instead if you stipulate that an object has a setitem that supports slice and fancy index setting, then all the specifics of vstack, hstack, and join stay in the table code where they belong. ![]() This is certainly possible but I would argue it is not preferred. You would then need to move that functionality to be specific to each class that can be an input, effectively having vstack, hstack, and join functionality for every supported table mixin class. There is currently the table high level operation code (for vstack, hstack, join) which knows all the details for assembling the output for any case. Likewise for hstack you don't know that they are all the same length, and for join you don't know that there won't be missing rows in the join. In other words, there is no guarantee when you stack two tables that all the columns match, so the new column may be longer than the sum of the length of the inputs. The problem is that this model does not generalize well to the case of missing values. ra, dec, distance) and then instantiating with the vstack'ed inputs? If so. I assume that you mean something like the new_like() method would create the new stacked Skåoord column from the input columns by first doing the vstacking on the individual data attributes (e.g. Returns - stacked_table : `~` object New table containing the stacked data from the input tables.That is, why can't it instead (optionally) create the correct thing initially and drop it in? This should be one of: * ``'silent'``: silently pick the last conflicting meta-data value * ``'warn'``: pick the last conflicting meta-data value, but emit a warning (default) * ``'error'``: raise an exception. metadata_conflicts : str How to proceed with metadata conflicts. table_names : list of str or None Two-element list of table names used when generating unique output column names. for ii, val in enumerate ( tables ): if isinstance ( val, Table ): pass elif isinstance ( val, Row ): tables = Table ( val ) elif isinstance ( val, Quantity ): tables = QTable () else : try : tables = Table () except ( ValueError, TypeError ): raise TypeError ( 'cannot convert '. # Special case that Quantity converts to a QTable. """ # Make sure we have a list of things if not isinstance ( tables, Sequence ): tables = # Make sure there is something to stack if len ( tables ) = 0 : raise ValueError ( 'no values provided to stack.' ) # Convert inputs (Table, Row, or anything column-like) to Tables. Returns the corresponding list of Tables. update ( out_meta ) def _get_list_of_tables ( tables ): """ Check that tables is a Table or sequence of Tables. meta, metadata_conflicts = metadata_conflicts ) out. meta ) for table in tables : out_meta = metadata. np_utils import fix_column_name, TableMergeError _all_ = def _merge_table_meta ( out, tables, metadata_conflicts = 'warn' ): out_meta = deepcopy ( tables. table import Table, QTable, Row, Column from astropy.units import Quantity from. """ High-level table operations: - join() - setdiff() - hstack() - vstack() """ # Licensed under a 3-clause BSD style license - see LICENSE.rst from copy import deepcopy import collections import itertools from collections import OrderedDict, Counter from collections.abc import Mapping, Sequence import numpy as np from astropy.utils import metadata from.
0 Comments
Leave a Reply. |