擅长:python、mysql、java
<p>一种方法是简单地使用嵌套for循环:</p>
<pre><code>res = (
pd.DataFrame([[v, name] for arr, name in zip([low, med, medh, high], ["Low", "Med", "Medh", "High"]) for v in arr],
columns=["Yield", "EC"]))
print(res)
</code></pre>
<p><strong>输出</strong></p>
<pre><code> Yield EC
0 59.5 Low
1 53.3 Low
2 56.8 Low
3 63.1 Low
4 58.7 Low
5 55.2 Med
6 59.1 Med
7 52.8 Med
8 54.5 Med
9 NaN Med
10 51.7 Medh
11 48.8 Medh
12 53.9 Medh
13 49.0 Medh
14 NaN Medh
15 44.6 High
16 48.5 High
17 41.0 High
18 47.3 High
19 46.1 High
</code></pre>