Hello to all,

I need to automate my Var X = df.iloc[; , [i[0]], [i[1]],...

Depending on len of i[n]

Something like;

i = [5, 16, 20, ... ]

if len(i) = 1

then X = df.iloc[: , [ i[0] ]]

if len(i) = 2

then X = df.iloc[: , [ i[0], i[1] ]]

and so on....

So need to manage the number of elements in X in order to use only some of my DF columns for the features in use on a logistic regression.

Thank you.

Filipe Santos

I need to automate my Var X = df.iloc[; , [i[0]], [i[1]],...

Depending on len of i[n]

Something like;

i = [5, 16, 20, ... ]

if len(i) = 1

then X = df.iloc[: , [ i[0] ]]

if len(i) = 2

then X = df.iloc[: , [ i[0], i[1] ]]

and so on....

So need to manage the number of elements in X in order to use only some of my DF columns for the features in use on a logistic regression.

Thank you.

Filipe Santos