Is it possible to store a numpy array in a single pandas cell? For example, let's assume we have the following df
import pandas as pd
import numpy as np
df= pd.DataFrame(np.nan, columns =["A","B","C"], index =np.arange(5))
It is possible to set a specific cell as follows
df.ix[1,"A"]=2 # This works
However, if I try to assign an numpy array, it fails with a ValueError: setting an array element with a sequence.
exception.
df.ix[1,"A"]=np.arange(5) #This fails
Is there any way to solve this? There is a similar solution on SO and it suggests to pass the values as numpy array as list but it seems not to work in my case.
df.ix[1,"A"]=list(np.arange(5)) #This also fails
Any suggestions?