minepy / mictools

A practical tool for Maximal Information Coefficient (MIC) analysis
GNU General Public License v3.0
128 stars 23 forks source link

Error at pval step #12

Open Nwilliams96 opened 1 year ago

Nwilliams96 commented 1 year ago

Hey, I'm unsure what the issue is here. I am able to run mictools null just fine, however when I need to run mictools pval I get the following error. Any idea how to fix this? Or is this something I need to take up with my systems administrator?

Error:

`Traceback (most recent call last): File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3790, in get_loc return self._engine.get_loc(casted_key) File "index.pyx", line 152, in pandas._libs.index.IndexEngine.get_loc File "index.pyx", line 181, in pandas._libs.index.IndexEngine.get_loc File "pandas/_libs/hashtable_class_helper.pxi", line 7080, in pandas._libs.hashtable.PyObjectHashTable.get_item File "pandas/_libs/hashtable_class_helper.pxi", line 7088, in pandas._libs.hashtable.PyObjectHashTable.get_item KeyError: 'None'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home1/nathanwi/.local/bin/mictools", line 8, in sys.exit(cli()) File "/home1/nathanwi/.local/lib/python3.9/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) File "/home1/nathanwi/.local/lib/python3.9/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) File "/home1/nathanwi/.local/lib/python3.9/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/home1/nathanwi/.local/lib/python3.9/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) File "/home1/nathanwi/.local/lib/python3.9/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) File "/home1/nathanwi/.local/lib/python3.9/site-packages/scripts/mictools_cmd.py", line 177, in pval mictools.pval.pval_cmd(xvars, null, output, labels, target, yvars, rowwise, File "/home1/nathanwi/.local/lib/python3.9/site-packages/mictools/pval.py", line 145, in pval_cmd obs_dist, obs, pval = compute_pval(X=X, File "/home1/nathanwi/.local/lib/python3.9/site-packages/mictools/pval.py", line 96, in compute_pval null_dist_cl = null_dist.loc[cl] File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 1153, in getitem return self._getitem_axis(maybe_callable, axis=axis) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 1393, in _getitem_axis return self._get_label(key, axis=axis) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexing.py", line 1343, in _get_label return self.obj.xs(label, axis=axis) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/generic.py", line 4228, in xs loc, new_index = index._get_loc_level(key, level=0) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexes/multi.py", line 3175, in _get_loc_level indexer = self._get_level_indexer(key, level=level) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexes/multi.py", line 3276, in _get_level_indexer idx = self._get_loc_single_level_index(level_index, key) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexes/multi.py", line 2865, in _get_loc_single_level_index return level_index.get_loc(key) File "/home1/nathanwi/.local/lib/python3.9/site-packages/pandas/core/indexes/base.py", line 3797, in get_loc raise KeyError(key) from err KeyError: 'None' `

vhminh2210 commented 11 months ago

Hello @Nwilliams96, I also went across similar problem with the command. Perhaps you can try installing a lower version of pandas. pip install pandas==1.1.0 works for me.

Also, you might want to reinstall some packages, in case other compatibility issues arrise.

pandas==1.1.0
numpy==1.19.5
matplotlib==3.3.0
scipy==1.6.0

Hope that this can help.

stephanbitterwolf commented 7 months ago

Hello @Nwilliams96, I also went across similar problem with the command. Perhaps you can try installing a lower version of pandas. pip install pandas==1.1.0 works for me.

Also, you might want to reinstall some packages, in case other compatibility issues arrise.

pandas==1.1.0
numpy==1.19.5
matplotlib==3.3.0
scipy==1.6.0

Hope that this can help.

^^ This fixed the same issue for me. Thanks!