How can i merge the dataframe which type is array?

for example.

   x      y
1 [1,2] [3,4]
2.[5,6] [7,8]

and… I want to get like this:

1 [1,2,3,4]
2 [5,6,7,8]

Is there have some idea resolve this problem?
thank you. and sorry my poor english… T^T

Good morning,
You could use,y),1)

as in

import torch
import numpy as np
a = [[1,2],[5,6]]
b = [[3,4],[7,8]]
x = torch.from_numpy(np.array(a))
y = torch.from_numpy(np.array(b))
u =,y),1)

1 Like

Oh… your answer is also correct. but If the csv file contain “list” type data

I should read the file like below:

df = pd.read_csv(“train_after.csv”, converters={“data”: literal_eval, “label”: literal_eval})

Thank you:)