我有一个这样的数据框:
POLY_KEY_I SP1_Percent SP2_Percent SP1_LOWER SP2_LOWER
0 FS01080100SM001 12.5 12.5 POAPRA TOXRYD
1 FS01080100SM001 0.0 0.0 NaN NaN
2 FS01080100SM001 2.5 2.5 TOXRYD SYMOCC
3 FS01080100SM001 20.0 20.0 EUPESU POAPRA
4 FS01080100SM001 12.5 12.5 BOUGRA KOEPYR
5 FS01080100SM002 22.5 22.5 POAPRA EUPESU
6 FS01080100SM002 12.5 0.0 POAPRA NaN
7 FS01080100SM002 15.0 15.0 POAPRA KOEPYR
我希望根据SP1_Lower
融化SP2_Lower
和POLY_KEY_I
,但我想保留关联的SP1_Percent
和SP2_Percent
。我可以用它来融化它:
df=pd.melt(df, id_vars='POLY_KEY_I', value_vars=['SP1_LOWER', 'SP2_LOWER'], value_name='SP')
但我想要的输出是:
POLY_KEY_I variable SP Percent
0 FS01080100SM001 SP1 POAPRA 12.5
1 FS01080100SM001 SP1 NaN 0
2 FS01080100SM001 SP1 TOXRYD 2.5
3 FS01080100SM001 SP1 EUPESU 20.0
4 FS01080100SM001 SP1 BOUGRA 12.5
5 FS01080100SM002 SP1 POAPRA 22.5
6 FS01080100SM002 SP1 POAPRA 12.5
7 FS01080100SM002 SP1 POAPRA 15.0
8 FS01080100SM001 SP2 TOXRYD 12.5
9 FS01080100SM001 SP2 NaN 0
10 FS01080100SM001 SP2 SYMOCC 2.5
11 FS01080100SM001 SP2 POAPRA 20.0
12 FS01080100SM001 SP2 KOEPYR 12.5
13 FS01080100SM002 SP2 EUPESU 22.5
14 FS01080100SM002 SP2 NaN 0
15 FS01080100SM002 SP2 KOEPYR 15.0
答案 0 :(得分:1)
您可以创建每个子部分的DataFrame,然后将它们连接在一起:
texture2D(u_texture, v_texCoords);