How do I:
I tried:
y = dataframe.iloc[:,-3:]
I tried:
X = dataframe.iloc[:,:-3]
Is this correct?
I am getting array dimensional errors further in my code and want to make sure this step is correct.
Thank you
The most efficient way:
1. Select last n columns
df1 = df.iloc[:,-n:]
2. Exclude last n columns
df1 = df.iloc[:,:-n]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With