required_time_stamps
contains 5911 time stamps
time_based_mfcc_feature
contains 5911 samples each having 20 mfcc features.
So if you
Since you've found already an answer for the first part of your question in the thread numpy-concatenate-2d-arrays-with-1d-array, I'll address the second question:
How do I truncate/delete the last few rows of A so that both A and B have same shapes like (8399,) and (8399, 21) . Please advise.
You can slice a numpy array like you would slice a list. So to trim a 2D-array B
to the size of A
along axis 0.
B = B[:A.shape[0],:]
This trims the end of the array. If you want to trim at the beginning, i.e. throw away the first few rows that don't fit into shape instead of the last:
B = B[-A.shape[0]:,:]
EDIT: Your comment implies that you don't know in advance which of the arrays is longer. In that case:
trim = min(A.shape[0], B.shape[0])
A = A[:trim]
B = B[:trim,:]
or respectively
trim = min(A.shape[0], B.shape[0])
A = A[-trim:]
B = B[-trim:,:]