Question: The following is easy on SQL but I cannot figure out how to do it on Pandas.

My inputs are:

```
import pandas as p    
symb = p.DataFrame(['a', 'b', 'c'], columns=['symb'])
fld = p.DataFrame(['field1', 'field2', 'field3'], columns=['fld'])

```

I want to be able to get the following DataFrame as output:

```
symb  fld
a     field1
a     field2
a     field3
b     field1
b     field2
b     field3
c     field1
c     field2
c     field3

```

Any idea on how to get to this result?

Thanks!

Answer: 
First create new columns with same values in both `DataFrames`. Then use [`merge`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.merge.html) by them and then [`drop`](http://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.drop.html) helper column:

```
symb['one'] = 1
fld['one'] = 1
print pd.merge(symb, fld, on='one').drop('one', axis=1)
  symb     fld
0    a  field1
1    a  field2
2    a  field3
3    b  field1
4    b  field2
5    b  field3
6    c  field1
7    c  field2
8    c  field3

```
Solution
========

```
pd.DataFrame(index=symb.symb, columns=fld.fld).fillna(0).stack().reset_index()[['symb', 'fld']]

```