title: how do I select 1 row of data from 1 output of a function that produces two 2d array outputs
body: <p>For context, I have a 2D Random walker function that outputs two 2d arrays. The two arrays represent the x position and the y position.
  Both these arrays are 2D because the No of columns represents the No of particles (100 columns is 100 particles) and the No of rows represents the steps each particle took (100 steps is 100 rows).</p>
  <p>The question: how do I select just the x position 2d array to plot the 50th row (50 steps) and all the columns (500) for that 50th row, in order to plot on a histogram?</p>
  <p>Below is the attempt I have made. Where particle_motion_2D(500,50,20) is the function. 500 is No of particles, 50 steps, 20 box width (which is unimportant for the question)</p>
  <pre><code>import matplotlib
  import matplotlib.pyplot as plt
  import numpy as np
  import random as rd
  import math as m
  
  
  def particle_motion_2D(P_xy,Steps,bwidth):
      X_Steps=[0,-1,1]
      Y_Steps=[0,-1,1]
      P_x= np.zeros(P_xy) 
      P_y= np.zeros(P_xy)
      States_Px=np.array([P_x])
      States_Py=np.array([P_y])
      
     
      for a in range(Steps):
          Box_Max_x=np.where(P_x &gt;= bwidth/2)
          Box_Min_x=np.where(P_x &lt;= -bwidth/2)
          Box_Max_y=np.where(P_y &gt;= bwidth/2)
          Box_Min_y=np.where(P_y &lt;= -bwidth/2)
          
          P_Mnt_x=np.array([rd.choice(X_Steps) for i in P_x])
          P_Mnt_y=np.array([rd.choice(Y_Steps) for i in P_y])
          
          P_Mnt_x[Box_Max_x]=-1
          P_Mnt_x[Box_Min_x]=+1
          P_Mnt_y[Box_Max_y]=-1
          P_Mnt_y[Box_Min_y]=+1
          
          P_x= P_x + P_Mnt_x
          P_y= P_y + P_Mnt_y
          
          States_Px = np.append(States_Px,[P_x],axis=0)
          States_Py = np.append(States_Py,[P_y],axis=0)
          
      
      return States_Px, States_Py
  
  
  Particle_RdWalk2D=particle_motion_2D(500,50,20) 
  
  Histo2d=Particle_RdWalk2D[50][0] 
  fig = plt.figure()#Plotting. 
  ax1.hist(Histo2d,bins=20,density=True)
  
  </code></pre>