Python Forum
How to join elements from two arrays in a third one?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to join elements from two arrays in a third one?
#1
Hi guys,

I have two arrays "p" and "prec" as the following.
p:
Output:
[[  2 -30  20   4] [  2 -28   30   4] [  2  19  50   6] [  1 -27  60   3] [  2   3  71   6]]
prec:
Output:
[[ 0  0.1  0  0.1] [ 0  0.1  0  0.1] [ 0  0.1  0  0.1] [ 0  0.1  0  0.1] [ 0  0.1  0  0.1]]
I'd like to construct a third array that joins element by element from the previous arrays with the Latex symbol '$\pm$' in the middle, like this:
Output:
[[  2 ± 0  -30 ± 0.1  20 ± 0  4 ± 0.1] [  2 ± 0  -28 ± 0.1  30 ± 0  4 ± 0.1] [  2 ± 0  19 ± 0.1  50 ± 0  6 ± 0.1] [  1 ± 0  -27 ± 0.1  60 ± 0  3 ± 0.1] [  2 ± 0  3 ± 0.1  71 ± 0  6 ± 0.1]]
So every element of the new array is composed of two numbers with ± in the middle. I tried different approaches, but I still have no idea about how to do it...
Thanks for the help !!
Reply


Messages In This Thread
How to join elements from two arrays in a third one? - by Felipe - Jul-12-2017, 12:20 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  how to join by stack multiple types in numpy arrays caro 1 1,839 Jun-20-2022, 05:02 PM
Last Post: deanhystad
  ValueError: Length mismatch: Expected axis has 8 elements, new values have 1 elements ilknurg 1 8,054 May-17-2022, 11:38 AM
Last Post: Larz60+
  Sorting Elements via parameters pointing to those elements. rpalmer 3 3,444 Feb-10-2021, 04:53 PM
Last Post: rpalmer
  The difference between os.path.join( and os.sep.join( Pedroski55 2 12,501 Nov-17-2020, 08:38 AM
Last Post: Pedroski55
  SQL select join operation in python(Select.. join) pradeepkumarbe 1 2,858 Feb-14-2019, 08:34 PM
Last Post: woooee
  How to sum up the elements of an integer using python split/join? mohanraj1986 5 4,796 Aug-27-2018, 09:13 AM
Last Post: perfringo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020