AttributeError of "to_dense" when using 'add_features()'

382 views
Skip to first unread message

Howard

unread,
Nov 10, 2020, 10:46:19 AM11/10/20
to neurosynth
Hi,

I am following the tutorial of neurosynth, but I meet an error saying AttributeError: 'DataFrame' object has no attribute 'to_dense' when running  'dataset.add_features(features.txt)' in Anaconda environment (python 3.8.3). 

After searching online, I found the 'to_dense' function is from pandas module and the error may be the version problem. However, I tried the version 1.0.5 and 1.1.4, and both versions were failed to solve the error.

Is there any other possibility causing this error? 
Thank for any advice in advance.

Best,
Howard
----------------------------------------------------------------
Here is the error:
dataset.add_features('features.txt')
Traceback (most recent call last):

  File "<ipython-input-9-000130bc8251>", line 1, in <module>
    dataset.add_features('features.txt')

  File "C:\Users\User\anaconda3\lib\site-packages\neurosynth\base\dataset.py", line 396, in add_features
    self.feature_table.add_features(features, merge=merge,

  File "C:\Users\User\anaconda3\lib\site-packages\neurosynth\base\dataset.py", line 624, in add_features
    old_data = self.data.to_dense()

  File "C:\Users\User\anaconda3\lib\site-packages\pandas\core\generic.py", line 5274, in __getattr__
    return object.__getattribute__(self, name)

AttributeError: 'DataFrame' object has no attribute 'to_dense'


Tal Yarkoni

unread,
Nov 10, 2020, 1:10:12 PM11/10/20
to neurosy...@googlegroups.com
Hi Howard,

I suspect the problem is that you have a newer version of pandas; to_dense() was deprecated at some point. The Neurosynth Python tools are now also deprecated, and are no longer maintained, so this is unlikely to be fixed. I suggest moving to NiMARE, which is actively maintained and under heavy development (https://github.com/neurostuff/NiMARE/).

Best,

Tal

--
You received this message because you are subscribed to the Google Groups "neurosynth" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neurosynthlis...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/neurosynthlist/9b5e6651-9e83-4cc5-8442-0bbb654e4618n%40googlegroups.com.

Howard

unread,
Nov 11, 2020, 8:04:19 AM11/11/20
to neurosynth
Hi Tal, 

Thank you for your response. I want to conduct feature-based meta-analysis and is happy to try with NiMARE, but I cannot find any tutorial or functions for feature-based meta-analysis in NiMARE. Has this function already built in NiMARE? Please let me know if I miss anything. Thank you again for your great help.

Best, 
Howard 

Tal Yarkoni 在 2020年11月11日 星期三上午2:10:12 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages