Having a multi dimensional array, and I want to introduced as a column into a df.
import pandas as pd
import numpy as np
x = np.array([[1, 2, 3], [4, 5, 6]], np.int32)
df = pd.DataFrame(['A', 'B'], columns=['First'])
Initial df:
First
0 A
1 B
Final output should be:
First Second
0 A [1,2,3]
1 B [4,5,6]
The final obj is to upload the table into a data base, and I understand is not the best way to keep records. If you have any recommendations are more than welcome.
Thanks.
df['second'] = [v for v in x]ordf['second'] = list(x)...