tables_io.conv.conv_table
Single-Table Conversion Functions for tables_io
Functions
|
Convert a Table-like object to a specific tabular format. |
|
Convert a pyarrow.Table to an astropy.table.Table |
Convert a pandas.DataFrame to an astropy.table.Table |
|
|
Convert a json string to an astropy.table.Table |
|
Convert an object to an astropy.table.Table |
|
Convert an astropy.table.Table to an OrderedDict of str : numpy.array |
|
Convert an np.recarray to an OrderedDict of str : numpy.array |
|
Convert a pandas.DataFrame to an OrderedDict of str : numpy.array |
|
Convert an pa.Table to an OrderedDict of str : numpy.array |
Convert a hdf5 object to an OrderedDict, (str, numpy.array) |
|
|
Convert a json string to an OrderedDict of numpy arrays |
|
Convert an object to an OrderedDict, (str, numpy.array) |
|
Convert an pyarrow.Table to an numpy.recarray |
|
Convert an astropy.table.Table to an numpy.recarray |
|
Convert an object to an numpy.recarray |
Convert an astropy.table.Table to a pandas.DataFrame |
|
|
Converts pyarrow.Table object to a pandas.DataFrame object. |
|
Convert an OrderedDict, (str, numpy.array) to a pandas.DataFrame |
|
Convert an object to a pandas.DataFrame |
|
Convert an astropy.table.Table to a pa.Table |
Convert a pandas.DataFrame to an pa.Table |
|
|
Convert an OrderedDict, (str, numpy.array) to a pa.Table |
|
Convert an object to a pa.Table |
|
Convert a numpy dict to a json string |
|
Convert an object to a json string |
Module Contents
- convert_table(obj, tType: str | int)[source]
Convert a Table-like object to a specific tabular format.
Accepted table formats:
Format string
Format integer
“astropyTable”
0
“numpyDict”
1
“numpyRecarray”
2
“pandasDataFrame”
3
“pyarrowTable”
4
“jsonString”
5
- Parameters:
obj (Table-like) – The object being converted
tType (int or str) – The type of object to convert to
- Returns:
out – The converted object
- Return type:
Table-like
- pa_table_to_ap_table(table)[source]
Convert a pyarrow.Table to an astropy.table.Table
- Parameters:
table (pyarrow.Table) – The table
- Returns:
tab – The table
- Return type:
astropy.table.Table
- data_frame_to_ap_table(df)[source]
Convert a pandas.DataFrame to an astropy.table.Table
- Parameters:
df (pandas.DataFrame) – The dataframe
- Returns:
tab – The table
- Return type:
astropy.table.Table
- json_to_ap_table(json_data)[source]
Convert a json string to an astropy.table.Table
- Parameters:
json_data (str) – The json
- Returns:
tab – The table
- Return type:
astropy.table.Table
- convert_to_ap_table(obj)[source]
Convert an object to an astropy.table.Table
- Parameters:
obj (object) – The object being converted
- Returns:
tab – The table
- Return type:
astropy.table.Table
- ap_table_to_dict(tab) Mapping[source]
Convert an astropy.table.Table to an OrderedDict of str : numpy.array
- Parameters:
tab (astropy.table.Table) – The table
- Returns:
data – The tabledata
- Return type:
OrderedDict, (str : numpy.array)
- recarray_to_dict(rec: numpy.recarray) Mapping[source]
Convert an np.recarray to an OrderedDict of str : numpy.array
- Parameters:
rec (np.recarray) – The input recarray
- Returns:
data – The tabledata
- Return type:
OrderedDict, (str : numpy.array)
- dataframe_to_dict(df) Mapping[source]
Convert a pandas.DataFrame to an OrderedDict of str : numpy.array
- Parameters:
df (pandas.DataFrame) – The dataframe
- Returns:
data – The tabledata
- Return type:
OrderedDict, (str : numpy.array)
- pa_table_to_dict(rec) Mapping[source]
Convert an pa.Table to an OrderedDict of str : numpy.array
- Parameters:
rec (pa.Table) – The input table
- Returns:
data – The tabledata
- Return type:
OrderedDict, (str : numpy.array)
- hdf5_group_to_dict(hg)[source]
Convert a hdf5 object to an OrderedDict, (str, numpy.array)
- Parameters:
hg (h5py.File or h5py.Group) – The hdf5 object
- Returns:
data – The tabledata
- Return type:
OrderedDict, (str : numpy.array)
- json_to_dict(json_data)[source]
Convert a json string to an OrderedDict of numpy arrays
- Parameters:
json_data (str) – The json
- Returns:
data – The tabledata
- Return type:
OrderedDict, (str : numpy.array)
- convert_to_dict(obj)[source]
Convert an object to an OrderedDict, (str, numpy.array)
- Parameters:
obj (object) – The object being converted
- Returns:
tab – The table
- Return type:
astropy.table.Table
- pa_table_to_recarray(tab)[source]
Convert an pyarrow.Table to an numpy.recarray
- Parameters:
tab (pyarrow.Table) – The table
- Returns:
rec – The output rec array
- Return type:
numpy.recarray
- ap_table_to_recarray(tab)[source]
Convert an astropy.table.Table to an numpy.recarray
- Parameters:
tab (astropy.table.Table) – The table
- Returns:
rec – The output rec array
- Return type:
numpy.recarray
- convert_to_recarray(obj)[source]
Convert an object to an numpy.recarray
- Parameters:
obj (object) – The object being converted
- Returns:
rec – The output recarray
- Return type:
numpy.recarray
- ap_table_to_dataframe(tab)[source]
Convert an astropy.table.Table to a pandas.DataFrame
- Parameters:
tab (astropy.table.Table) – The table
- Returns:
df – The dataframe
- Return type:
pandas.DataFrame
- pa_table_to_dataframe(table)[source]
Converts pyarrow.Table object to a pandas.DataFrame object.
- Parameters:
table (pyarrow.Table) – Input table
- Returns:
df – The converted dataframe.
- Return type:
pandas.DataFrame
- dict_to_dataframe(odict: Mapping, meta: Mapping | None = None)[source]
Convert an OrderedDict, (str, numpy.array) to a pandas.DataFrame
- Parameters:
odict (OrderedDict, (str, numpy.array)) – The dict
meta (dict or None) – Optional dictionary of metadata
- Returns:
df – The dataframe
- Return type:
pandas.DataFrame
- convert_to_dataframe(obj)[source]
Convert an object to a pandas.DataFrame
- Parameters:
obj (object) – The object being converted
- Returns:
df – The dataframe
- Return type:
pandas.DataFrame
- ap_table_to_pa_table(tab)[source]
Convert an astropy.table.Table to a pa.Table
- Parameters:
tab (astropy.table.Table) – The table
- Returns:
table – The output table
- Return type:
pa.Table
- dataframe_to_pa_table(df)[source]
Convert a pandas.DataFrame to an pa.Table
- Parameters:
df (pandas.DataFrame) – The dataframe
- Returns:
table – The table
- Return type:
pa.Table
- dict_to_pa_table(odict: Mapping, meta: Mapping | None = None)[source]
Convert an OrderedDict, (str, numpy.array) to a pa.Table
- Parameters:
odict (OrderedDict, (str, numpy.array)) – The dict
meta (dict or None) – Optional dictionary of metadata
- Returns:
table – The table
- Return type:
pa.Table
- convert_to_pa_table(obj)[source]
Convert an object to a pa.Table
- Parameters:
obj (object) – The object being converted
- Returns:
table – The table
- Return type:
pa.Table