np.where multiple return values
<p>Using pandas and numpy I am trying to process a column in a dataframe, and want to create a new column with values relating to it. So if in column x the value 1 is present, in the new column it would be a, for value 2 it would be b etc</p>

<p>I can do this for single conditions, i.e </p>

<pre><code>df['new_col'] = np.where(df['col_1'] == 1, a, n/a)
</code></pre>

<p>And I can find example of multiple conditions i.e if x = 3 or x = 4 the value should a, but not to do something like if x = 3 the value should be a and if x = 4 the value be c.</p>

<p>I tried simply running two lines of code such as :</p>

<pre><code>df['new_col'] = np.where(df['col_1'] == 1, a, n/a)
df['new_col'] = np.where(df['col_1'] == 2, b, n/a)
</code></pre>

<p>But obviously the second line overwrites. Am I missing something crucial?</p>