Python Forum
Computing the distance between each pair of points
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Computing the distance between each pair of points
#11
(Jun-18-2020, 07:31 PM)Truman Wrote: smth doesn't work well.
because in the example x = np.array([[[1],[2],[3]], [[4],[5],[6]]]). that is 3D array

import numpy as np

x = np.array([[[1],[2],[3]], [[4],[5],[6]]])
print(x[:,np.newaxis,:,:].shape)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#12
Yes, I forgot what shapeis for. I definitely have to be more careful and focused.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to most effectively unpack list of name-value pair dictionaries in a dataframe? zlim 1 613 Nov-07-2023, 10:56 PM
Last Post: zlim
  Could anyone help me get the jaccard distance between my dataframes please? :) a_real_phoenix 0 1,746 Jun-27-2019, 06:01 PM
Last Post: a_real_phoenix
  Converting days to years in loop while computing values across grid cells Lightning1800 2 2,594 May-15-2018, 08:44 PM
Last Post: Lightning1800
  Error in computing FFT operation raady07 1 4,176 Jan-18-2017, 08:30 AM
Last Post: j.crater

Forum Jump:

User Panel Messages

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