tables_io
tables_io is a library of functions for input, output and conversion of tabular data formats
Submodules
Package Contents
Classes
A partial implementation of a lazily imported module. |
|
Object to collect various types of table-like objects |
Functions
|
Lazily load a module |
Attributes
- class LazyModule(name)[source]
A partial implementation of a lazily imported module.
This isn’t a general solution, since it doesn’t actually create a module-like object, but the LazyLoader solution in importlib seems not to cope with submodules like astropy.table, or pyarrow.parquet, and always imports the full module.
- property module
- class TableDict[source]
Bases:
collections.OrderedDict
Object to collect various types of table-like objects
This class is a dictionary mapping name to table-like and a few helper functions, e.g., to add new tables to the dictionary and to read and write files, either as FITS or HDF5 files.
- write(basepath, fmt=None)[source]
Write tables to the corresponding file type
- Parameters:
basepath (str) – base path for output files. Suffix will be added based on type
fmt (str or None) – The output file format, If None this will use writeNative
- convert(tType)[source]
Build a new TableDict by converting all the table in the object to a different type
- Parameters:
tType (int) – The type to convert to
- Returns:
td – The new TableDict
- Return type:
TableDict
- classmethod read(filepath, tType=None, fmt=None, keys=None)[source]
Read a file to the corresponding table type
- Parameters:
filepath (str) – File to load
tType (int or None) – Table type, if None this will use readNative
fmt (str or None) – File format, if None it will be taken from the file extension
keys (list or None) – Keys to read for parquet files
- Returns:
tableDict – The data
- Return type:
TableDict