Question: Without using any Python modules, implement a UDF get_target_values(A, tgt_index) that will return the value given by target_index in each row of a matrix
Without using any Python modules, implement a UDF get_target_values(A, tgt_index) that will return the value given by target_index in each row of a matrix A. The UDF is expected to return a list of integers. For example, if A is [[1,2,3], [4,-5,-6,3,7,8,9], [1,-1,101]] and tgt_index is 2, the expected output from the UDF is [3,-6, 101]. You can assume that the item count for each row in A will always be greater than the value of tgt_index. You are reminded to practice good programming practices in your code.
Step by Step Solution
3.48 Rating (155 Votes )
There are 3 Steps involved in it
Heres a Python function gettargetvalues that takes a matrix A and a target inde... View full answer
Get step-by-step solutions from verified subject matter experts
