Closed JohannesWiesner closed 9 months ago
happened the same to me. A PR has been made to update the code; try git clone installation instead of pip install to get the most up-to-date probes_.py (worked for me)
Fixed for the main branch. Please reopen if this issue still persists.
Issue still persists. Created a new environment using
micromamba create -n abagen -c conda-forge nilearn numpy pandas spyder
(this will result in pandas == 2.2.0)
Activated this environment and pip-installed abagen:
micromamba activate abagen
pip install abagen
Ran abagen.get_expression_data
and got
expression, counts, report = abagen.get_expression_data(atlas_img,
File ~/micromamba/envs/abagen/lib/python3.12/site-packages/abagen/allen.py:444 in get_expression_data
microarray = probes_.collapse_probes(flatten_dict(files, 'microarray'),
File ~/micromamba/envs/abagen/lib/python3.12/site-packages/abagen/probes_.py:757 in collapse_probes
micro = micro.set_axis(symbols, axis=1, inplace=False)
TypeError: DataFrame.set_axis() got an unexpected keyword argument 'inplace'
Hi @JohannesWiesner, please install from GitHub (pip install git+https://github.com/rmarkello/abagen.git
) as we have not released a new version on PyPI yet.
Hi @JohannesWiesner, please install from GitHub (
pip install git+https://github.com/rmarkello/abagen.git
) as we have not released a new version on PyPI yet.
Hi @liuzhenqi77 , I have encountered the same issue and tried following your suggestion to download directly from GitHub. This unfortunately yielded the following error:
File ~/anaconda3/lib/python3.11/site-packages/abagen/allen.py:461 in get_expression_data
labels = atlas[subj].label_samples(annotation[subj], tolerance)
File ~/anaconda3/lib/python3.11/site-packages/abagen/matching.py:255 in label_samples
labels = self._match_volume(samples, abs(tolerance))
File ~/anaconda3/lib/python3.11/site-packages/abagen/matching.py:334 in _match_volume
matches = self.tree.query_ball_point(subsamp[cols], tol)
File _ckdtree.pyx:947 in scipy.spatial._ckdtree.cKDTree.query_ball_point
File ~/anaconda3/lib/python3.11/site-packages/pandas/core/generic.py:1526 in __nonzero__
raise ValueError(
ValueError: The truth value of a Series is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Hi @elosse, this might have been cause by scipy scipy/scipy/issues/18800 and appears to have been fixed. Could you please update your scipy to latest version if possible, and let us know if it works? Thanks!
Hi @liuzhenqi77 , updating scipy did fix the issue, while using pandas 2.2.1 . Thank you!
I had the same problem.
expression = abagen.get_expression_data(atlas['image'])
C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py:147: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
return io.read_microarray(microarray).groupby(sid, axis=1).mean()
C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py:147: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
return io.read_microarray(microarray).groupby(sid, axis=1).mean()
C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py:147: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
return io.read_microarray(microarray).groupby(sid, axis=1).mean()
C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py:147: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
return io.read_microarray(microarray).groupby(sid, axis=1).mean()
C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py:147: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
return io.read_microarray(microarray).groupby(sid, axis=1).mean()
C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py:147: FutureWarning: DataFrame.groupby with axis=1 is deprecated. Do `frame.T.groupby(...)` without axis instead.
return io.read_microarray(microarray).groupby(sid, axis=1).mean()
Traceback (most recent call last):
File "F:\ProgramData\anaconda3\Lib\site-packages\IPython\core\interactiveshell.py", line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-13-3a6b7b093269>", line 1, in <module>
expression = abagen.get_expression_data(atlas['image'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\allen.py", line 444, in get_expression_data
microarray = probes_.collapse_probes(flatten_dict(files, 'microarray'),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\12772\AppData\Roaming\Python\Python311\site-packages\abagen\probes_.py", line 757, in collapse_probes
micro = micro.set_axis(symbols, axis=1, inplace=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: DataFrame.set_axis() got an unexpected keyword argument 'inplace'
I installed abagen version 0.1.4, python3.11, pandas 2.2.1, and scipy is also the latest version.
Same problem here.
Downgrade pandas to 1.5.3 works for me, with a warning:
FutureWarning: DataFrame.set_axis 'inplace' keyword is deprecated and will be removed in a future version. Use obj = obj.set_axis(..., copy=False)
instead
tar_collect.set_axis(selected_targets, axis=1, inplace=True)
Please try installing from GitHub (pip install git+https://github.com/rmarkello/abagen.git
) as we have not released a new version on PyPI yet.
pip install git+https://github.com/rmarkello/abagen.git
Thank you. My problem was solved after downloading the latest version of abagen.
With the latest version of pandas I get this error:
Seem like the latest version of pandas does not have this argument anymore.
One should either update the requirements file and specify a maximum pandas version or rewrite the code so it works with pandas 2.1.2