I'm running Python 2.7.9. I have two numpy arrays (100000 x 142 and 100000 x 20) that I want to concatenate into 1, 100000 x 162 array.
The following is the code I'm running:
import numpy as np
import pandas as pd
def ratingtrueup():
actones = np.ones((100000, 20), dtype='f8', order='C')
actualhhdata = np.array(pd.read_csv
('C:/Users/Desktop/2015actualhhrating.csv', index_col=None, header=None, sep=','))
projectedhhdata = np.array(pd.read_csv
('C:/Users/Desktop/2015projectedhhrating.csv', index_col=None, header=None, sep=','))
adjfctr = round(1 + ((actualhhdata.mean() - projectedhhdata.mean()) / projectedhhdata.mean()), 5)
projectedhhdata = (adjfctr * projectedhhdata)
actualhhdata = (actones * actualhhdata)
end = np.concatenate((actualhhdata.T, projectedhhdata[:, 20:]), axis=1)
ratingtrueup()
I get the following value error:
File "C:/Users/PycharmProjects/TestProjects/M.py", line 16, in ratingtrueup end = np.concatenate([actualhhdata.T, projectedhhdata[:, 20:]], axis=1) ValueError: all the input array dimensions except for the concatenation axis must match exactly
I've confirmed that both arrays are 'numpy.ndarry'.
Is there a way to I check the dimensions of the input array to see where I'm going wrong.
Thank you in advance.
ndim
, and if you want to guarantee a certain dimensionnp.atleast_1d
,np.atleast_2d
ornp.atleast_3d
- Saullo G. P. Castroprint actualhhdata.shape, projectedhhdata[:, 20:].shape
it should clear things up. - tom10