Skip to content
Advertisement

python) update value of array in dictionary and update it

I want to update ‘array’ inside the dictionary after doing interpolation.

for example, “array_ex” is a dictionary and has values like below and ‘0_array’ has (6,100) shape while ‘1_array’ has (6,200) shape…

JavaScript

I wrote a function for interpolating the array using np.interp. The function interpolates the shape of array (6,100) to (6,200). However, how can I update my array after interpolating? The name of function is “convert_array”.

JavaScript

I want to get “array_ex” with updated array after interpolation. Thanks.

Advertisement

Answer

Start with a dict containing arrays:

JavaScript

Make a new dict from those arrays, same keys, new arrays:

JavaScript

Or with a loop more like yours:

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement