I have this table, and I want to create a scatter plot of say left Hippocampus in axis "X" against left Cerebral Cortex in axis "Y", because is a hierarchical column I don't know how to choose the specific column I need.
I tried:
tabla1.plot(kind="scatter", x=(tabla1.iloc[:, tabla1.columns.get_level_values(Hippocampus)=='left']), y=(tabla1.iloc[:, tabla1.columns.get_level_values(["Cerebral Cortex "])=='left']), alpha=0.6, c='black')
but I got this error:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Can you help me?
Also, how can I get rid of the hierarchical columns and create separate columns instead?:
|RID|str_dx|cerebral cortex left| cerebral cortex right| hippocampus left| hippocampus right| |----|-----|-----------------|----------------------|------------------|--------------------| because I think is easier to work in this way.
Thanks.
https://stackoverflow.com/questions/67411293/how-to-plot-data-from-hierarchical-columns May 06, 2021 at 11:06AM
没有评论:
发表评论