I have an array of n length and I want to resize it to a certain length conserving the proportions.
I would like a function like this:
def rezise_my_array(array, new_lentgh)
Run Code Online (Sandbox Code Playgroud)
For example, the input would be an array of length 9:
l = [1,2,3,4,5,6,7,8,9]
Run Code Online (Sandbox Code Playgroud)
If I rezise it to length 5, the output would be:
[1,3,5,7,9]
Run Code Online (Sandbox Code Playgroud)
or vice versa.
I need this to create a linear regression model on pyspark, since all the features must have the same length.