Reputation: 1960
I have a series S
of 263 elements, each is a ndarray
with the shape 1X768
.
I need to convert it to dataframe. So, the dataframe should have the shape 263X768
and include the actual data from S
.
What is the best way to do it?
Upvotes: 0
Views: 29
Reputation: 9941
You can use np.vstack
:
# list of ndarrays
x = [np.ones((1, 768)) for x in range(263)]
# create dataframe
df = pd.DataFrame(np.vstack(x))
df.shape
Output:
(263, 768)
Upvotes: 1