Question: I want to know the difference between the `Class(const Class & c)` constructor and the `Class(Class & c)` constructor in C++.

```
class Class
{
public:
    Class()
    {
       cout << "running Class()..." << endl;
    }
    Class(Class& c)
    {
        cout << "running Class(Class& c)..." << endl;
    }
    Class(const Class& c)
    {
        cout << "runing Class(const Class& c)..." << endl;
    }
};

```

`Class` is defined as above.

I know that `Class(const Class& c)` is a copy constructor. It will be called when new Class object is created. For example:

```
Class c;  // output->running Class()...
Class cc(c); // output->runing Class(const Class& c)...

```

Now, I want to know when the `Class(Class& c)` constructor will be called.

Answer: 
Use [`Series.unstack`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.unstack.html) with [`DataFrame.stack`](http://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.stack.html):

```
df1 = (df.set_index(['id','t'])['price']
         .unstack()
         .stack(dropna=False)
         .reset_index(name='price'))
print (df1)
    id  t  price
0    1  0   10.0
1    1  1   10.2
2    1  2   10.8
3    1  3   10.1
4    1  4   10.4
5    1  5    NaN
6    1  6    NaN
7    1  7    NaN
8    2  0    NaN
9    2  1    NaN
10   2  2  142.1
11   2  3  142.8
12   2  4  143.6
13   2  5  142.8
14   2  6  141.4
15   2  7  140.7

```
One option is to use the [complete](https://pyjanitor-devs.github.io/pyjanitor/api/functions/#janitor.functions.complete.complete) function from [pyjanitor](https://pyjanitor-devs.github.io/pyjanitor/) to expose the implicitly missing rows;

```py
# pip install pyjanitor
import pandas as pd
import janitor

df.complete("id", {"t": range(7)}, sort=True)

    id  t  price
0    1  0   10.0
1    1  1   10.2
2    1  2   10.8
3    1  3   10.1
4    1  4   10.4
5    1  5    NaN
6    1  6    NaN
7    2  0    NaN
8    2  1    NaN
9    2  2  142.1
10   2  3  142.8
11   2  4  143.6
12   2  5  142.8
13   2  6  141.4
14   2  7  140.7

```

In the code above, [complete](https://pyjanitor-devs.github.io/pyjanitor/api/functions/#janitor.functions.complete.complete) combines `id` with a range of 0 to 7 for `t` to build a new dataframe, and expose the missing rows.