Closed
Description
related here: #7203
If I haven't missed something, there's no simple way to make cartesian product method in pandas. For example, see http://stackoverflow.com/questions/19684765/pandas-extending-the-dataframe-by-adding-another-levels/19684948#19684948.
To do cross join, one have to add some keys to DataFrames, like this:
>>> dfA = pd.DataFrame(['a','b','c'],columns=['A'])
>>> dfB = pd.DataFrame(range(3),columns=['B'])
>>> dfA['key'] = 1
>>> dfB['key'] = 1
>>> pd.merge(dfB, dfA, on='key').ix[:, ('A','B')]
A B
0 a 0
1 b 0
2 c 0
3 a 1
4 b 1
5 c 1
6 a 2
7 b 2
8 c 2
How about adding possibility to pass how='cross' into merge() and join() methods?