我有以下DataFrame:
Item Weight Bags Must quantity must quantity bags length length assigned bag
0 planes bag 8.50 planes v 1 1 6 None
1 Full Bandolera 3.76 planes v 3 2 6 None
2 tail 0.30 planes <NA> 3 2 6 None
3 central wing 1.08 planes <NA> 3 2 6 None
4 engine 0.44 planes <NA> 3 2 6 None
5 height steer 0.12 planes <NA> 3 2 6 None
6 dihedral 0.40 planes <NA> 3 2 6 None
7 pods bag 8.72 pods v 1 1 4 None
8 Pod 1.74 pods v 3 2 4 None
9 optic 0.86 pods v 2 2 4 None
10 thermal 1.20 pods v 3 2 4 None
11 Encryption Cable 0.20 Ground <NA> 1 0 25 None
System,
我想根据“行李长度”列中的值提取“项目和重量”列中的所有值。
must_pods = cls.df.loc[
cls.df[DfConsts.ITEM, DfConsts.WEIGHT]
if cls.df.loc[cls.df[DfConsts.BAGS_COLUMN_LENGTH] == BagsStringLength.GROUND_SYSTEM_LEN]
我知道pandas不接受if语句,但是我不知道该操作的正确语法。