Skip to content

Conversion to and from dataframes does not work #112

@danolson1

Description

@danolson1

I am trying to clean an SBtab file by converting each sbtable to a dataframe, clean the dataframe, and then convert back to an sbtable. There is an error in the from_data_frame() function. On line 934, the sbtab columns are assigned from the dataframe columns without adding a ! character in front of each one.

sbtab.columns = df.columns.tolist() should be sbtab.columns = ['!' + x for x in df.columns.tolist()]

Here's an example of some code that could be used to test this

def df_conversion_check(sbtab):
    """check conversion between dataframe and sbtab table"""
    df = sbtab.to_data_frame()
    return SBtab.SBtabTable.from_data_frame(df, sbtab.table_id, sbtab.table_type, sbtab.table_name)

sbtable_before = s.sbtabs[0] # get an sbtable object from somewhere

display(sbtable_before.to_data_frame())
sbtable_after = df_conversion_check(sbtable_before)
display(sbtable_after.to_data_frame())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions