Problem with iloc/select coulums from my database

I have this output from sfs.k_feature_idx_ :
(0, 4, 7)
which are the indexes of the columns that I need.
I would like to take these coloumns from my database but I don’t know how. I tried with iloc but there are round brackets instead of square ones.
(The length of the output is not defined, but it can change every time)
Please help!
Thanks a lot

Hi Roccardo, and welcome.

I’m not as familiar with iloc as you are, so I cannot guess what:

“I tried with iloc but there are round brackets instead of square ones.”

means. Can you copy and paste the actual code you tried, and the actual
error message you got? Don’t post a screenshot or photo.

For posting code, there’s a button in the web UI for setting the text to
“code”. Otherwise the indents will be lost. If you are replying by
email, surround your code with three backticks (on their own), like
this:

```
code goes here
```

But my guess is that something like this will work:

# sfs.k_feature_idx_ returns the columns (0, 4, 7)
columns = (0, 4, 7)
for column in columns:
    print( iloc[column] )

Good luck!

1 Like