Frank
Frank

Reputation: 1027

pyspark.sql.types.Row to list

My initial data set are:

{'ID': [Row(userid=17562323, gross_merchandise_value=6072210944, country=u'ID'), Row(userid=29989283, gross_merchandise_value=4931252224, country=u'ID')]

the type of dict value is pyspark.sql.types.Row

How to convert the dict to the userid list? like below:

[17562323, 29989283],

just get the userid list.

Upvotes: 9

Views: 27175

Answers (1)

Frank
Frank

Reputation: 1027

thank you above all,the problem solved.I use row_ele.asDict()['userid'] in old_row_list to get the new_userid_list

Upvotes: 5

Related Questions