Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unknown format code 'd' for object of type 'float' #41

Closed
dlippold opened this issue Nov 9, 2017 · 3 comments
Closed

Unknown format code 'd' for object of type 'float' #41

dlippold opened this issue Nov 9, 2017 · 3 comments
Milestone

Comments

@dlippold
Copy link

dlippold commented Nov 9, 2017

After I installed genipe (on a fully updated Fedora 25 system) as described in the documentation I executed the test and get an error message.

In detail I did the following as root:

dnf install python3 python3-devel python3-numpy python3-jinja2 python3-pandas python3-setuptools

And then I did the following as a user:

pyvenv $HOME/genipe_pyvenv
source $HOME/genipe_pyvenv/bin/activate
pip install genipe
pip install pyfaidx
python
import genipe
genipe.test()

After that I get the following error message:

ERROR: test_read_phenotype (genipe.tests.test_imputed_stats.TestImputedStats)
Tests the 'read_phenotype' function.

Traceback (most recent call last):
File "/home/user/genipe_pyvenv/lib64/python3.5/site-packages/genipe/tests/test_imputed_stats.py", line 248, in test_read_phenotype
filename, args,
File "/home/user/genipe_pyvenv/lib64/python3.5/site-packages/genipe/tools/imputed_stats.py", line 251, in read_phenotype
(sex_counts.index == 2))].sum()
ValueError: Unknown format code 'd' for object of type 'float'

I get one more error message which is described in another ticket.

It seems to me that the character 'd' in line 247 of the file genipe/tools/imputed_stats.py has to be replaced by the character 'f'.

The output of the command source $HOME/genipe_pyvenv/bin/activate; python --version; deactivate is: Python 3.5.4

@lemieuxl
Copy link
Member

lemieuxl commented Nov 9, 2017

The failed test looks like it's related to pandas version 0.21.

$ pip list
Package         Version
--------------- -------
genipe          1.3.3  
Jinja2          2.10   
MarkupSafe      1.0    
numpy           1.13.3 
pandas          0.21.0 
pip             9.0.1  
pyfaidx         0.5.1  
python-dateutil 2.6.1  
pytz            2017.3 
setuptools      36.6.0 
six             1.11.0 
$ python -m unittest genipe.tests.test_imputed_stats.TestImputedStats.test_read_phenotype
E
======================================================================
ERROR: test_read_phenotype (genipe.tests.test_imputed_stats.TestImputedStats)
Tests the 'read_phenotype' function.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/lemieuxl/genipe_pyvenv/lib64/python3.6/site-packages/genipe/tests/test_imputed_stats.py", line 248, in test_read_phenotype
    filename, args,
  File "/home/lemieuxl/genipe_pyvenv/lib64/python3.6/site-packages/genipe/tools/imputed_stats.py", line 251, in read_phenotype
    (sex_counts.index == 2))].sum()
ValueError: Unknown format code 'd' for object of type 'float'

----------------------------------------------------------------------
Ran 1 test in 0.008s

FAILED (errors=1)

If you downgrade to pandas version 0.20, the test should pass.

pip uninstall pandas
pip install pandas==0.20
$ pip list
Package         Version
--------------- -------
genipe          1.3.3  
Jinja2          2.10   
MarkupSafe      1.0    
numpy           1.13.3 
pandas          0.20.0 
pip             9.0.1  
pyfaidx         0.5.1  
python-dateutil 2.6.1  
pytz            2017.3 
setuptools      36.6.0 
six             1.11.0 
$ python -m unittest genipe.tests.test_imputed_stats.TestImputedStats.test_read_phenotype
.
----------------------------------------------------------------------
Ran 1 test in 0.114s

OK

I will fix this in a future release, but, for now, I suggest downgrading to pandas version 0.20.

@lemieuxl lemieuxl added this to the 1.3.4 milestone Nov 9, 2017
@dlippold
Copy link
Author

dlippold commented Nov 9, 2017

Thanks for your immediate answer.

I first had to install the RPM packages redhat-rpm-config and gcc-c++ (by dnf install redhat-rpm-config gcc-c++). Then the two pip commands run successful and the error was gone.

@dlippold dlippold closed this as completed Nov 9, 2017
@lemieuxl
Copy link
Member

lemieuxl commented Nov 9, 2017

Yes, to downgrade pandas, you need to compile from the source code.
I'll keep the ticket opened until I fix the code for the newest version of pandas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants