Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

pyspark get row value from row object

avatar
Explorer

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]