title: How to create a new column with percentiles?
body: <p>I'm looking for a way to create a new column in a dataframe, with percentile values of a different column.</p>
  <pre><code>arr = np.random.randint(1,300,10)
  
  df3 = pd.DataFrame(arr, columns =['x'])
  </code></pre>
  <p>I can then find for example, the 50th percentile by:</p>
  <pre><code>np.percentile(df3['x'], 50)
  </code></pre>
  <p>What I'd really like to do is create another column, with which percentile each value in <code>df3['x']</code> falls into.</p>
  <p>I tried a for loop, which just went completely wrong. So any advice here would be great.</p>
  <p>This is basically what I'm looking for:</p>
  <p><a href="https://i.stack.imgur.com/esB3D.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/esB3D.png" alt="This is basically what I'm looking for" /></a></p>