title: pandas.get_dummies() throws ValueError: Wrong number of items passed 4, indices imply 3
body: <p>I have an ipython notebook based on pandas 2 calling pandas' get_dummies(). This function converts categorical variable into dummy/indicator variables. It works on one machine but not in another one. Both machines run linux mint, python 2.7. See the minimal example below.</p>
  
  <p>I see the error (ValueError: Wrong number of items passed 4, indices imply 3) on some other posts but the workarounds do not help, and as I wrote the code works on another machine. 
  Any idea what to do? For example, how to compare the two installation of ipython/jupiter and the packages? </p>
  
  <pre><code>import pandas as pandas
  df = pandas.DataFrame({ 'A' : pandas.Series(1,index=list(range(4)),dtype='float32'),
                       'B' : 2.,
                       'C' : pandas.Categorical(["test","train","test","train"])})
  print df
  pandas.get_dummies(df)
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>A  B      C
  0  1  2   test
  1  1  2  train
  2  1  2   test
  3  1  2  train
  
  [4 rows x 3 columns]
  ---------------------------------------------------------------------------
  ValueError                                Traceback (most recent call last)
  &lt;ipython-input-2-cf3a14671e3b&gt; in &lt;module&gt;()
        5                      'C' : pd.Categorical(["test","train","test","train"])})
        6 print df
  ----&gt; 7 pd.get_dummies(df)
  
  /usr/lib/python2.7/dist-packages/pandas/core/reshape.pyc in get_dummies(data, prefix, prefix_sep, dummy_na)
      946     """
      947     # Series avoids inconsistent NaN handling
  --&gt; 948     cat = Categorical.from_array(Series(data))
      949     levels = cat.levels
      950 
  
  /usr/lib/python2.7/dist-packages/pandas/core/series.pyc in __init__(self, data, index, dtype, name, copy, fastpath)
      220                                        raise_cast_failure=True)
      221 
  --&gt; 222                 data = SingleBlockManager(data, index, fastpath=True)
      223 
      224         generic.NDFrame.__init__(self, data, fastpath=True)
  
  /usr/lib/python2.7/dist-packages/pandas/core/internals.pyc in __init__(self, block, axis, do_integrity_check, fastpath)
     3591                 block = block[0]
     3592             if not isinstance(block, Block):
  -&gt; 3593                 block = make_block(block, axis, axis, ndim=1, fastpath=True)
     3594 
     3595         else:
  
  /usr/lib/python2.7/dist-packages/pandas/core/internals.pyc in make_block(values, items, ref_items, klass, ndim, dtype, fastpath, placement)
     1991 
     1992     return klass(values, items, ref_items, ndim=ndim, fastpath=fastpath,
  -&gt; 1993                  placement=placement)
     1994 
     1995 
  
  /usr/lib/python2.7/dist-packages/pandas/core/internals.pyc in __init__(self, values, items, ref_items, ndim, fastpath, placement)
     1356         super(ObjectBlock, self).__init__(values, items, ref_items, ndim=ndim,
     1357                                           fastpath=fastpath,
  -&gt; 1358                                           placement=placement)
     1359 
     1360     @property
  
  /usr/lib/python2.7/dist-packages/pandas/core/internals.pyc in __init__(self, values, items, ref_items, ndim, fastpath, placement)
       62         if len(items) != len(values):
       63             raise ValueError('Wrong number of items passed %d, indices imply '
  ---&gt; 64                              '%d' % (len(items), len(values)))
       65 
       66         self.set_ref_locs(placement)
  
  ValueError: Wrong number of items passed 4, indices imply 3
  </code></pre>