Archives of Support Questions (Read Only)

This is an archived board for historical reference. Information and links may no longer be available or relevant
Announcements
This board is archived and read-only for historical reference. To ask a new question, please post a new topic on the appropriate active board.

pyspark get row value from row object

avatar
New Member

Using .collect method I am able to create a row object my_list[0] which is as shown below

my_list[0]

Row(Specific Name/Path (to be updated)=u'Monitoring_Monitoring.csv')

How Can I fetch row value . It gives synatx errors as there are spaces in row name.

1 ACCEPTED SOLUTION

avatar
Super Guru

@bharat sharma,

You can do it in the 2 ways

my_list[0].__getitem__("col name")
my_list[0].asDict()["col name"]

Please "Accept" the answer if this works.

.

-Aditya

View solution in original post

2 REPLIES 2

avatar
Super Guru

@bharat sharma,

You can do it in the 2 ways

my_list[0].__getitem__("col name")
my_list[0].asDict()["col name"]

Please "Accept" the answer if this works.

.

-Aditya

avatar
Expert Contributor

OR

.collect()[0][1]