I have a dataframe df1=
HPE FRE UNE
0 S0 S0 S0
1 S1 S1 S1
using the below code("reduce" is a functool function, sta is a list containing the columns of df1):
reduce(lambda x,y:np.add.outer(x,y),sta).reshape(-1)
I reduced my dataframe to numpy array like this:
['S0S0S0' 'S0S0S1' 'S0S1S0' 'S0S1S1' 'S1S0S0' 'S1S0S1' 'S1S1S0' 'S1S1S1']
but I want my output to look like below:
['S0|S0|S0' 'S0|S0|S1' 'S0|S1|S0' 'S0|S1|S1' 'S1|S0|S0' 'S1|S0|S1' 'S1|S1|S0' 'S1|S1|S1']
How can I do?