0

How can the numpy arrays in column B of the DataFrame

import pandas as pd
import numpy as np

df = pd.DataFrame({"A":[1,2],"B":[np.asarray([1,2],dtype=float),np.asarray([3,4],dtype=float)]})

print(df)
   A           B
0  1  [1.0, 2.0]
1  2  [3.0, 4.0]

be pivoted, such that the resulting df looks like

print(df_result)
   A  B
0  1  1.0
1     2.0
2  2  3.0
3     4.0

?

BigBen
  • 46,229
  • 7
  • 24
  • 40
Oblomov
  • 8,953
  • 22
  • 60
  • 106

0 Answers0