我對Pandas頗爲陌生,目前在嘗試在Dataframe中插入Dataframe時遇到了問題。熊貓:在Dataframe中存儲數據幀
我想要做什麼: 我有多個模擬和相應的信號文件,我希望它們都在一個大的DataFrame中。所以我想要一個DataFrame,它具有我所有的模擬參數,並且還有我的信號作爲嵌套的DataFrame。它應該是這個樣子:
SimName | Date | Parameter 1 | Parameter 2 | Signal 1 | Signal 2 |
Name 1 | 123 | XYZ | XYZ | DataFrame | DataFrame |
Name 2 | 456 | XYZ | XYZ | DataFrame | DataFrame |
哪裏SimName是我的大數據幀和信號1的每個條目和信號2指數是individuall數據幀。
我的想法是實現這個是這樣的:
big_DataFrame['Signal 1'].loc['Name 1']
但是,這導致一個ValueError異常:
Incompatible indexer with DataFrame
是否可以在熊貓這種嵌套DataFrames?
尼科
你應該表現出你的初始數據... – IanS
你是什麼意思與初使數據?現在我創建DataFrame並列出所有模擬列表,然後將每個模擬數據添加到另一個 –
爲什麼要在df中存儲df?看看[熊貓小組](https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Panel.html)。 – Parfait