tlubitz / SBtab

SBtab - Table format for Systems Biology:
www.sbtab.net
MIT License
6 stars 8 forks source link

error when changing attribute in SBtab #105

Closed eladnoor closed 3 years ago

eladnoor commented 3 years ago

When I create a table using from_data_frame, the header_row is created as a list. However, the code usually assumes it is a string. This fails in the change_attribute function.

Here is some code to reproduce the bug:

import pandas
from sbtab import SBtab
df = pandas.DataFrame(data=[[1, 2], [3, 4]], columns=["x", "y"])
sbtab = SBtab.SBtabTable.from_data_frame(df, table_id="A", table_type="B")
sbtab.change_attribute("attr", 1)
tlubitz commented 3 years ago

Is there a crucial reason why from_data_frame creates the header as a list? Since SBtab uses a string as header, I would recommend fixing this issue in from_data_frame. I can do that, if you like. Just wanted to ask whether there is a special reasoning behind the list.

eladnoor commented 3 years ago

No, it is either a mistake, or some legacy code that I forgot to update.

On Tue, Nov 17, 2020, 16:30 Timo Lubitz notifications@github.com wrote:

Is there a crucial reason why from_data_frame creates the header as a list? Since SBtab uses a string as header, I would recommend fixing this issue in from_data_frame. I can do that, if you like. Just wanted to ask whether there is a special reasoning behind the list.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/tlubitz/SBtab/issues/105#issuecomment-728965687, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA523DKSE6CTNM33XSW27P3SQKCJXANCNFSM4TYS2EPA .