I would like to create dataframe as below. I tried to create it but there some several for loops and many code lines to do. Is there any efficent way to create dataframe?
what I have:
x=array([a,b,c,d])
y=array([A,B,C,D])
id=array([1,2,3,4])
what I want to have:
df:
id type cat
1 a x
2 b x
3 c x
4 d x
1 A y
2 B y
3 C y
4 D y
pd.concat([pd.DataFrame({'id:id, 'type':x, 'cat':'x'}), pd.DataFrame({'id:id, 'type':y, 'cat':'y'})])