Pandas: Storing Dataframe in Dataframe

前端 未结 3 989
梦如初夏
梦如初夏 2021-01-22 15:19

I am rather new to Pandas and am currently running into a problem when trying to insert a Dataframe inside a Dataframe.

What I want to do: I have multiple simulations a

3条回答
  •  独厮守ぢ
    2021-01-22 15:30

    The 'pointers' referred to at the end of ns63sr's answer could be implemented as a class, e.g...

    Definition:

    class df_holder:
        def __init__(self, df): 
            self.df = df
    

    Set:

    df.loc[0,'df_holder'] = df_holder(df)
    

    Get:

    df.loc[0].df_holder.df
    

提交回复
热议问题