Skip to content
Advertisement

Merge two Lists of different size

I have an issue with some part of my code, I’m fetching two apis and then mixing the results in one array:

Initialy the two arrays seems like this (although they can be empty or with more or less data):

JavaScript

Their shapes are:

JavaScript

So of course, when I try to append them in the 2nd dimension:

JavaScript

I get this error:

JavaScript

My question is what would be the best solution to this, trying to not loose data, maybe appending each sublist manually work but is it the only solution I have?

Advertisement

Answer

One array only has 1 dimension, the other has 2. But you can quickly adjust the first array to have dimensions (7,1) by using newaxis

For example:

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