How to concatenate two numpy arrays

Two-dimensional array

a = np.array([[1,5,9],[2,6,10]])
b = np.array([[3,7,11],[4,8,12],[13,14,15]])
np.concatenate((a,b))
np.vstack((a,b))

Both concatenate and vstack return same output:

array([[ 1, 5, 9],
      [ 2, 6, 10],
      [ 3, 7, 11],
      [ 4, 8, 12],
      [13, 14, 15]])
array([[ 1, 5, 9],
       [ 2, 6, 10],
       [ 3, 7, 11],
       [ 4, 8, 12],
       [13, 14, 15]])

One dimensional array

a = np.array([1,5,3])
b = np.array([3,7,11])
np.concatenate((a,b))
np.vstack((a,b))

concatenate returns:

array([ 1, 5, 3, 3, 7, 11])

but vstack returns:

array([[ 1, 5, 3],
       [ 3, 7, 11]])
Iklan

pgAdmin4, No Module Called Encoding

If you ended up here, probably you curiously have opened pgAdmin4 config dialog, change nothing and poof! pgAdmin4 throws an error next time you open it.

[bit@bitwise ~]$ pgadmin4
Python path:  "" 
Python Home:  "/usr/lib/pgadmin4/venv"
Fatal Python error: initfsencoding: Unable to get the locale encoding
ModuleNotFoundError: No module named 'encodings'
Current thread 0x00007f438e486c80 (most recent call first):
Aborted (core dumped)

I reinstall pgAdmin4 many times using pacman, change PYTHONHOME and PYTHONPATH variables, but no luck. Frustated, in the next day, an epiphany flow into my head, if pgAdmin4 throws an error after the config altered, why i don’t delete the config file?

[bit@bitwise ~]$ mv ~/.config/pgadmin/pgadmin4.conf  ~/.config/pgadmin/pgadmin4.conf.old

Setup Indonesian Jamu Herbs

Setup DB

[postgres@bitwise ~]$ sudo -u postgres -i
[postgres@bitwise ~]$ createuser --interactive -P
Enter name of role to add: ijah
Enter password for new role:
Enter it again:
Shall the new role be a superuser? (y/n) n
Shall the new role be allowed to create databases? (y/n) n
Shall the new role be allowed to create more new roles? (y/n) n
[postgres@bitwise ~]$ createdb -O ijah IJAH

continued