PEtab-dev / PEtab-dev/libpetab-python
Should unspecified optional strings be the empty string or NaN?
Ninguém assumiu esta issue ainda.
- Linguagem predominante
- Python
- Estrelas
- 18
- Forks
- 9
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Descrição
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
Guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Avaliação
- Stack de tecnologia
- pandas, python
- Domínio
- data
- Tipo de issue
- Bug
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Status de atividade
- Estagnada
- Clareza
- Razoavelmente clara
- Facilidade para iniciantes
- 35/100