title: Increase Dimensionality of a xarray from coordinates
body: <p>Say I have the following 2d-array</p>
  
  <pre><code>&gt;&gt;&gt; import numpy as np
  &gt;&gt;&gt; budgets = np.array([
         [np.nan, 450.],
         [500.  , 100.],
         [np.nan, 900.],
      ])
  </code></pre>
  
  <p>whose values are positioned like so</p>
  
  <pre><code>&gt;&gt;&gt; coords = [
          ('name' , ['Jack_teen' , 'John_adult', 'John_teen']), # over rows
          ('hobby', ['books', 'bicyle']),                       # over columns
      ]
  </code></pre>
  
  <p>Using <a href="http://xarray.pydata.org/en/stable/" rel="nofollow noreferrer">xarray</a> I can create a 2d labeled array, doing</p>
  
  <pre><code>&gt;&gt;&gt; import xarray as xr
  &gt;&gt;&gt; x = xr.DataArray(budgets, coords=coords)
  </code></pre>
  
  <p>Thus when John was a teenager, he did not like books, which is visible if one gets its budget at that time</p>
  
  <pre><code>&gt;&gt;&gt; x.sel(name='John_teen', hobby='books')
  &lt;xarray.DataArray ()&gt;
  array(nan)
  Coordinates:
      name     |S10 'John_teen'
      hobby    |S6 'books'
  </code></pre>
  
  <p>What has changed with age</p>
  
  <pre><code>&gt;&gt;&gt; x.sel(name='John_adult', hobby='books')
  &lt;xarray.DataArray ()&gt;
  array(500.0)
  Coordinates:
      name     |S10 'John_adult'
      hobby    |S6 'books'
  </code></pre>
  
  <p><hr>
  My question:</p>
  
  <p>How would you do to turn this 2dl-array into a 3dl-array which considers a new dimension called <code>age</code> (whose coordinates would thus be <code>['adult','teen'])</code> while simplifying the coordinates of the dimension <code>name</code>?</p>
  
  <p>Note that <code>name</code>'s coordinates are <strong><em>always</em></strong> structured with a separating underscore, I mean as NAME_AGE. Of course the object with which you start to do this is <code>x</code>.</p>
  
  <p>Are there xarray-builtin manners to do this ? Or at least what is the fastest/cheapest approach ?</p>