擅长:python、mysql、java
<p>看起来你在试图转换矩阵。这里有一种方法可以使用熊猫来实现这一点:</p>
<pre><code>import pandas as pd
from io import StringIO
csv_data = '''A,B,C,D
1.0, 2.0, 3.0, 4.0
5.0, 6.0, 7.0, 8.0
9.0, 10.0, 11.0, 12.0'''
df = pd.read_csv(StringIO(csv_data))
df.transpose()
</code></pre>