I have a dataset like the following :
Survived PassengerId Pclass
1.0 1.0 1.0
20.0 179.0 1.5
39.0 357.0 2.0
58.0 535.0 2.5
77.0 713.0 NaN
96.0 NaN NaN
NaN NaN NaN
NaN NaN NaN
NaN NaN NaN
NaN NaN NaN
And i want to create all possible combinations of these row wise. Something like :
Survived PassengerId Pclass
1.0 1.0 1.0
1.0 1.0 1.5
1.0 1.0 2.0
1.0 1.0 2.5
20.0 179.0 1.0
20.0 179.0 1.5
20.0 179.0 2.0
20.0 179.0 2.5
. . .
. . .
. . .
1.0 713.0 2.5
20.0 713.0 2.5
39.0 713.0 2.5
58.0 713.0 2.5
77.0 713.0 2.5
96.0 713.0 2.5
Since there are 6, 5 and 4 unique observations in each column so the new dataframe will have 6*5*4 = 120 rows.
There is a similar function in R called expand.grid however, need it purely in python.
Does anyone have a similar function written in Python? Thank you.