Hi,
I want to concatenate two numpy arrays with shape (n1,n2) and (n1,n3)
into a single array with shape (n1,n2+n3). I guess there is an elegant
way to do this but I couldn't figure it out. So any help is very much
appreciated.
Regards
Rolf 1 2385
Rolf Wester wrote:
Hi,
I want to concatenate two numpy arrays with shape (n1,n2) and (n1,n3)
into a single array with shape (n1,n2+n3). I guess there is an elegant
way to do this but I couldn't figure it out. So any help is very much
appreciated.
Suppose a1.shape is (n1,n2)
and a2.shape is (n1,n3)
Then you want to do
a3 = concatenate((a1 ,a2),axis=1)
or equivalently
a3 = hstack([a1,a2])
a3 = r_['1',a1,a2]
-Travis This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: 2mc |
last post by:
I am finding out all kinds of ways to do things in NumPy through the
many suggestions I have received. It's exciting. Thanks to all who
have replied on my other threads.
I'm still having trouble with one thing. Let me set a scenario and
see if anyone has any ideas.
Assume a multidimensional array (2d). This would be like a
spreadsheet...
|
by: Pepijn Kenter |
last post by:
Hi all.
I'm new to python and want to use it for an assignment.
I have succesfully implemented a galois field class including the _repr__,
__mul__, __div__, __add__ and __sub__ methods. Basically a galois field is
an integer modulo a prime number. Now I want to make a matrix of these
galois field objects using the numpy library....
|
by: sonjaa |
last post by:
Hi
last week I posted a problem with running out of memory when changing
values in NumPy arrays. Since then I have tried many different
approaches and
work-arounds but to no avail.
I was able to reduce the code (see below) to its smallest size and
still
have the problem, albeit at a slower rate. The problem appears to come
|
by: robert |
last post by:
in Gnuplot (Gnuplot.utils) the input array will be converted to a Numeric float array as shown below. When I insert a numpy array into Gnuplot like that below, numbers 7.44 are cast to 7.0
Why is this and what should I do ? Is this bug in numpy or in Numeric?
>>m #numpy array
array(,
,
,
...,
,
|
by: Chris Smith |
last post by:
Howdy,
I'm a college student and for one of we are writing programs to
numerically compute the parameters of antenna arrays. I decided to use
Python to code up my programs. Up to now I haven't had a problem,
however we have a problem set where we are creating a large matrix and
finding it's inverse to solve the problem. To invert the matrix...
| |
by: Grant Edwards |
last post by:
How do you print a numpy array?
I tried the obvious print a, print `a`, and print str(a), but
none of them work on anything other than trivially small
arrays. Most of my real data is elided and replaced with
ellipses.
--
Grant Edwards grante Yow! I want to kill
at everyone here with a cute
|
by: Duncan Smith |
last post by:
Hello,
Since moving to numpy I've had a few problems with my existing
code. It basically revolves around the numpy scalar types. e.g.
------------------------------------------------
array(,
])
Traceback (most recent call last):
File "<pyshell#30>", line 1, in -toplevel-
|
by: sapsi |
last post by:
Hello,
I have a numpy array (2 rows 3 colums)
import numpy
a=numpy.array( , ])
I wish to add a row, this is how i do it
s=a.shape
numpy.resize(a,s+1,s)
|
by: Sean Davis |
last post by:
I have a set of numpy arrays which I would like to save to a gzip
file. Here is an example without gzip:
b=numpy.ones(1000000,dtype=numpy.uint8)
a=numpy.zeros(1000000,dtype=numpy.uint8)
fd = file('test.dat','wb')
a.tofile(fd)
b.tofile(fd)
fd.close()
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |