Support Questions

Find answers, ask questions, and share your expertise

pyspark get row value from row object

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

@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

@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

Expert Contributor

OR

.collect()[0][1]