After one hot encoding, instead of columns, my number of rows are increasing
get_dummies function of pandas can also be used for this. Just create a pandas dataframe with your data and subject it to this function. There is no need to list categorical variables: 

X_train_df = pandas.DataFrame(data=X_train)
X_train_df_1hot = pandas.get_dummies(X_train_df)


You can specify prefix etc also for new columns is required: 

pandas.get_dummies(data, prefix=None, prefix_sep='_', 
     dummy_na=False, columns=None, 
     sparse=False, drop_first=False, 
     dtype=None)


Data as a list of lists is available with .values attribute which can be converted to a numpy array: 

housing_cat_1hot = numpy.array(X_train_df_1hot.values)