我有一個列表,我想將它作爲一個行。我得到的最接近的是使用post。但是,我無法得到我的答案。將二維numpy陣列轉換爲數據幀行
例如可以說我有值的testarray
,
([[ 26.85406494],
[ 27.85406494],
[ 28.85406494],
[ 29.85406494],
[ 30.85406494],
[ 31.85406494],
[ 32.85406494],
[ 33.85406494],
[ 34.85406494],
[ 35.85406494],
[ 36.85406494],
[ 37.85406494],
[ 38.85406494],
[ 39.85406494],
[ 40.85406494],
[ 41.85406494]])
我需要一個像作爲pandas
數據幀行就是這樣,
Row_value
0 26.85406494
1 27.85406494
2 29.85406494
...
我嘗試以下,
df = pd.DataFrame({'Row_value':testarray})
我收到一個錯誤,
ValueError: If using all scalar values, you must pass an index
如何將這些值與索引一起傳遞?
不錯的方式與列! –