Extract values from an array that sum to a certain value pyspark
I have a dataframe that has an array with doubles as values. Within the array, 1 or a sum of the numbers equals a certain target value, and I want to extract the values that either equal the value or can be summed to equal the value. I'd like to be able to do this in PySpark.
| Array | Target | NewArray |
| -----------------------|-----------|------------------|
| [0.0001,2.5,3.0,0.0031]| 0.0032 | [0.0001,0.0031] |
| [2.5,1.0,0.5,3.0] | 3.0 | [2.5, 0.5, 3.0] |
| [1.0,1.0,1.5,1.0] | 4.5 | [1.0,1.0,1.5,1.0]|
from Recent Questions - Stack Overflow https://ift.tt/3l7juTQ
https://ift.tt/eA8V8J
Comments
Post a Comment