I'm trying to create a panda dataframe from nested list that contains ndarray inside below:
from numpy import array
a = list([[1,2],[2,3]])
a[0] = array([[1,2]])
a[0][0] = array([1,2])
what I want to achieve is below:
D0 D1
1 2
2 3
I've tried just using
pd.DataFrame(a)
which creates
D0
[1,2]
[2,3]
I also tried using pd.append inside the for loop
for i in range(0, len(a)):
df = df.append(pd.DataFrame(a[i]))
which achieves what I want but it's extremely slow and somehow the df.append creates duplicates.
Please help.
Thx in advance.
df = pd.DataFrame(array.tolist()), ordf = pd.DataFrame([list(x) for x in array]). Whichever works