0

I have a transform a dataframe which look like this

+---------+------+
|  Country|Status|
+---------+------+
|[AW,null]|    14|
|[UG,null]|    47|
|[CY,null]|  1324|
|[AO,null]|    20|
|[US,null]|325242|
|[KE,null]|   246|
|[DK,true]|     1|
|[ES,null]|  2127|
|[IT,true]|     2|
+----------------+

Now I have to transform it into a dataframe which consist of three columns and looks something like this

+---------+--------+------+
|  Country|status  |Count |
+---------+--------+------+
|AW       |null    |    14|
|UG       |null    |    47|
|CY       |null    |  1324|
|AO       |null    |    20|
|US       |null    |325242|
|KE       |null    |   246|
|DK       |true    |     1|
|ES       |null    |  2127|
|IT       |true    |     2|
+---------+-------+-------+
Mukesh Jha
  • 125
  • 1
  • 1
  • 6
  • 1
    Did you see [this](http://stackoverflow.com/questions/34362412/pyspark-split-a-column-to-multiple-columns-without-pandas) and [this](http://stackoverflow.com/questions/39235704/split-spark-dataframe-string-column-into-multiple-columns) ? – David Arenburg Dec 01 '16 at 08:37
  • What is the type of column? – anshul_cached Dec 01 '16 at 11:30
  • Possible duplicate of [Querying Spark SQL DataFrame with complex types](http://stackoverflow.com/questions/28332494/querying-spark-sql-dataframe-with-complex-types) –  Dec 01 '16 at 13:34

0 Answers0