Sort a column containing string in Pandas
<p>I am new to Pandas, and looking to sort a column containing strings and generate a numerical value to uniquely identify the string. My data frame looks something like this:</p>

<pre><code>df = pd.DataFrame({'key': range(8), 'year_week': ['2015_10', '2015_1', '2015_11', '2016_9', '2016_10','2016_3', '2016_9', '2016_10']})
</code></pre>

<p>First I like to sort the <code>'year_week'</code> column to arrange in ascending order <code>(2015_1, 2016_9, '2016_9', 2016_10, 2016_11, 2016_3, 2016_10, 2016_10)</code> and then generate a numerical value for each unique <code>'year_week'</code> string. </p>