I have a data frame "p" and a np array "b" as follow
p=pd.DataFrame([["j","k","h"],[4,5,6],[7,8,9]])
j k h
4 5 6
7 8 9
b=np.array([["a",10],["b",20],["c",30],["d",40]])
a 10
b 20
c 30
d 40
I want to insert the np array to the dataframe and make become as follow
j k h
a 10 10
b 20 20
c 30 30
d 40 40
Notice p is wider than b and b is longer than p
Basically:
- keep the first row of the p
- insert b into p from second row
- repeat second column of b to the rest of column of p