Abdol
Abdol

Reputation: 1

'get_data' object has no attribute 'set_index'

I was trying to run this code to generate a heatmap, but I keep getting this error, any suggestion

from bioinfokit import analys, visuz
# load dataset as pandas dataframe
path = '/Users/ss/Desktop/test/Name.csv'
df = analys.get_data('path')

# set radiomics features as index
df = df.set_index(df.columns[0])
df.head(2)

visuz.gene_exp.hmap(df=df, rowclus=False, colclus=False, dim=(3, 6), tickfont=(6, 4))

AttributeError Traceback (most recent call last) in 5 6 # set Radiomics features as index ----> 7 df = df.set_index(df.columns[0]) 8 df.head(2) 9

AttributeError: 'get_data' object has no attribute 'set_index'

Upvotes: 0

Views: 1001

Answers (1)

Hans Musgrave
Hans Musgrave

Reputation: 7141

Looking at your traceback, either analys.get_data(...) isn't the object you think it is, or it is the object you think it is doesn't support set_index.

Looking at the docs for get_data, an appropriate fix would probably be:

df = analys.get_data(path).data

Upvotes: 2

Related Questions