Question: I have a DataFrame, `sega_df`:

```
>>> sega_df
                        0          1          2          
Tails            20161016
Knuckles         20170202   20101216                
Sonic            20160623   20101203   20160603
Amy              20160923
Shadow           20160919   20160723
Cream            20110309
Silver           20160405
Blaze            20161014

```

Is there a way I can make duplicate rows for characters with more than one column, and move them directly under the original row name? (`Knuckles`, `Sonic`, and `Shadow`).

**Desired Output**

```
>>> sega_df
                        0                             
Tails            20161016
Knuckles         20170202   
Knuckles         20101216                
Sonic            20160623   
Sonic            20101203   
Sonic            20160603
Amy              20160923
Shadow           20160919   
Shadow           20160723
Cream            20110309
Silver           20160405
Blaze            20161014

```

Answer: 
Here is a way using [`df.stack()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.stack.html) and [`df.droplevel()`](https://pandas.pydata.org/pandas-docs/version/0.24.0rc1/api/generated/pandas.Series.droplevel.html) with [`series.to_frame()`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.to_frame.html)

```
df.stack().droplevel(1).to_frame()

```

---

```
                   0
Tails     20161016.0
Knuckles  20170202.0
Knuckles  20101216.0
Sonic     20160623.0
Sonic     20101203.0
Sonic     20160603.0
Amy       20160923.0
Shadow    20160919.0
Shadow    20160723.0
Cream     20110309.0
Silver    20160405.0
Blaze     20161014.0

```
Here's another way using melt:

```
df = df.melt(id_vars='', value_name='0').dropna().drop('variable', axis=1)

```

which returns:

```
                   0

Tails     20161016.0
Knuckles  20170202.0
Sonic     20160623.0
Amy       20160923.0
Shadow    20160919.0
Cream     20110309.0
Silver    20160405.0
Blaze     20161014.0
Knuckles  20101216.0
Sonic     20101203.0
Shadow    20160723.0
Sonic     20160603.0

```