I have a DF1,

```
df1 = sc.parallelize([(1, "book1", 1), (2, "book2", 2), (3, "book3", 3), (4, "book4", 4)]).toDF(["primary_key", "book", "number"])

```

[![enter image description here](https://i.stack.imgur.com/jPNO0.png)](https://i.stack.imgur.com/jPNO0.png)

and DF2,

```
df2 = sc.parallelize([(1, "book1", 1), (2, "book8", 8), (3, "book3", 7), (5, "book5", 5)]).toDF(["primary_key", "book", "number"])

```

[![enter image description here](https://i.stack.imgur.com/SG4IT.png)](https://i.stack.imgur.com/SG4IT.png)

```
from pyspark.sql import functions
columlist = sc.parallelize(["book", "number"])

```

The result would be, (Vertical way)

```
[![enter image description here][3]][3]

```

[![enter image description here](https://i.stack.imgur.com/lF3wn.png)](https://i.stack.imgur.com/lF3wn.png)

How can i achieve this in python spark ?