I'd like to select one column only but all the rows except last row.
If I did it like below, the result is empty.
a = data_vaf.loc[:-1, 'Area']
loc
:location
iloc
:index location.
They just can't operate implicitly.
Therefore we exclude last raw by iloc
then select the column Area
As shown by the comment from @ThePyGuy
data_vaf.iloc[:-1]['Area']
Here's the structure of
iloc[row, column]
And
iloc[row]
do the same thing as iloc[row,:]
df.iloc[:-1]
do the same thing as df[:-1]
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