You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@zeppelin.apache.org by Suresh Ayyavoo <su...@iappsasia.com> on 2017/03/13 03:53:52 UTC

How can i convert below DataFrame array to string

Hi All,

How can i convert below DataFrame [accountID: array<string>, completed_at:
array<string>, created_at: array<string>] to
[accountID: string, completed_at: string, created_at: string]

root

 |-- accountID: array (nullable = true)

 |    |-- element: string (containsNull = true)

 |-- completed_at: array (nullable = true)

 |    |-- element: string (containsNull = true)

 |-- created_at: array (nullable = true)

 |    |-- element: string (containsNull = true)


root
|-- accountID: string (containsNull =true)
|-- completed_at: string (containsNull =true)
|--create_at : string (containsNull =true)


Thanks

Re: How can i convert below DataFrame array to string

Posted by Suresh Ayyavoo <su...@iappsasia.com>.
Thanks also below code helped

df.select(concat_ws(",",$"result.accountID") as "accountID")

On Tue, Mar 14, 2017 at 5:35 AM, Felix Cheung <fe...@hotmail.com>
wrote:

> Explode?
>
> https://spark.apache.org/docs/latest/api/python/pyspark.sql.
> html?highlight=explode#pyspark.sql.functions.explode
>
>
> For Spark questions like this, try stackoverflow
>
> spark.apache.org/community.html
>
>
>
>
> ------------------------------
> *From:* Suresh Ayyavoo <su...@iappsasia.com>
> *Sent:* Sunday, March 12, 2017 8:53:52 PM
> *To:* users@zeppelin.apache.org
> *Subject:* How can i convert below DataFrame array<string> to string
>
> Hi All,
>
> How can i convert below DataFrame [accountID: array<string>,
> completed_at: array<string>, created_at: array<string>] to
> [accountID: string, completed_at: string, created_at: string]
>
> root
>
>  |-- accountID: array (nullable = true)
>
>  |    |-- element: string (containsNull = true)
>
>  |-- completed_at: array (nullable = true)
>
>  |    |-- element: string (containsNull = true)
>
>  |-- created_at: array (nullable = true)
>
>  |    |-- element: string (containsNull = true)
>
>
> root
> |-- accountID: string (containsNull =true)
> |-- completed_at: string (containsNull =true)
> |--create_at : string (containsNull =true)
>
>
> Thanks
>
>
>


-- 

Suresh Ayyavoo

Solution Architect / R&D Lead

iAPPS Pte. Ltd.

3 Fusionopolis Way, Symbiosis #13-25 S(138633)

[O] 64631795   [F] 6778 5300 [M] 91540224

Website: www.iappsasia.com

Facebook: www.facebook.com/iappsasia

Youtube: www.youtube.com/user/iAPPSasia

Re: How can i convert below DataFrame array to string

Posted by Felix Cheung <fe...@hotmail.com>.
Explode?

https://spark.apache.org/docs/latest/api/python/pyspark.sql.html?highlight=explode#pyspark.sql.functions.explode


For Spark questions like this, try stackoverflow

spark.apache.org/community.html<http://spark.apache.org/community.html>



________________________________
From: Suresh Ayyavoo <su...@iappsasia.com>
Sent: Sunday, March 12, 2017 8:53:52 PM
To: users@zeppelin.apache.org
Subject: How can i convert below DataFrame array<string> to string

Hi All,

How can i convert below DataFrame [accountID: array<string>, completed_at: array<string>, created_at: array<string>] to
[accountID: string, completed_at: string, created_at: string]


root

 |-- accountID: array (nullable = true)

 |    |-- element: string (containsNull = true)

 |-- completed_at: array (nullable = true)

 |    |-- element: string (containsNull = true)

 |-- created_at: array (nullable = true)

 |    |-- element: string (containsNull = true)


root
|-- accountID: string (containsNull =true)
|-- completed_at: string (containsNull =true)
|--create_at : string (containsNull =true)


Thanks