A = [1,1,1,...-1,1,1]
B = apple, banana
0 333, 356
1 364, 675
2 643, 346
. ..., ...
344 325, 356
B reads csv as dataframe.
A and B are the same 345.
At this time, if A is 1, I would like to extract only the Apple value of B.
B.iloc [np.where(A>0)] extracts both apple and banana, so
B.iloc [np.where(A>0), 0], but I got an error when there were many indexes.
Is there a way to avoid taking it out with for as much as possible?
python3 pandas csv
B.loc [A>0, 'apple']
Maybe it's OK to
© 2024 OneMinuteCode. All rights reserved.