-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
spotfire.sbdf.export_data does not appear to save pandas data frame index data to SBDF files. Perhaps we could save the index information to an extra column and put in metadata to indicate that it is index information.
Code to reproduce issue:
import os
import tempfile
import pandas as pd
import spotfire
import pandas.testing as pdt
TGT_DIR = tempfile.gettempdir()
FILE_NAME = "data.sbdf"
file_path = os.path.join(TGT_DIR, FILE_NAME)
col_1 = list(range(1, 11))
col_2 = [i * i for i in col_1]
df_1 = pd.DataFrame({"col_1": col_1, "col_2": col_2})
df_1.index = [
"a", "b", "c", "d", "e",
"f", "g", "h", "i", "j"
]
print("--- df_1 ---")
print(df_1)
spotfire.sbdf.export_data(
df_1,
os.path.join(TGT_DIR, file_path)
)
df_2 = spotfire.sbdf.import_data(
os.path.join(TGT_DIR, file_path)
)
print("--- df_2 ---")
print(df_2)
pdt.assert_frame_equal(df_1, df_2)Metadata
Metadata
Assignees
Labels
No labels