def table_convert(fmt="csv"):
"""Convert the SC data into different formats.
To make available for download.
"""
# others netcdf, fits?
# https://pandas.pydata.org/pandas-docs/stable/io.html
if fmt not in ['tsv', 'csv', 'hdf']:
raise NotImplementedError("Conversion format to {} not available.".format(fmt))
name = "data/sweet-cat.{}".format(fmt)
if fmt is "tsv": # This is the standard
pass
else:
df = pd.read_table('data/sweet-cat.tsv')
if fmt == "hdf":
df.to_hdf(name, key="sweetcat", mode="w", format='table')
elif fmt == "csv":
df.to_csv(name, sep=",", index=False)
评论列表
文章目录