PEtab-dev / PEtab-dev/libpetab-python
Should unspecified optional strings be the empty string or NaN?
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 18
- 分支
- 9
- PR 合併指標
- 30 天內沒有已合併 PR
描述
At the moment, there can be NaNs (after pd.read_csv) in optional PEtab string columns, such as observableNames, that, if interpreted as a string, are converted to the string literal 'nan'.
>>> import numpy as np
>>> str(np.nan)
'nan'
An issue can occur in the AMICI plotting functions. This issue can be fixed by replacing
elif model.getObservableNames()[iy] != '':
with
elif model.getObservableNames()[iy] in ['', 'nan']:
to correctly identify unspecified observable names. However, testing for the string 'nan' seems unintuitive, and this fix might cause another issue if an observable is named 'nan'.
Here's a solution, which could be implemented in PEtab, and might resolve the issue in AMICI.
$ cat test_str.csv
observableId observableName
a_id a_name
b_id
>>> import pandas as pd
>>> df1 = pd.read_csv('test_str.csv', sep='\t')
>>> df2 = pd.read_csv('test_str.csv', sep='\t')
>>> df2['observableName'] = df2['observableName'].fillna('')
>>> df1
observableId observableName
0 a_id a_name
1 b_id NaN
>>> df2
observableId observableName
0 a_id a_name
1 b_id
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
Start by reviewing the PEtab optional string-column handling described in the issue and the affected entry point in AMICI's python/amici/plotting.py at line 81. Decide how unspecified values should be represented without confusing a literal 'nan' name, then verify the behavior across parsing and plotting integration.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- pandas, python
- 領域
- data
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100