convert Series to DataFrame
<p>I created a dataframe 'x' </p>

<p>I wanted to create another dataframe y which consists of values of feature 'wheat_type' from dataframe x</p>

<p>so i executed the code</p>

<pre><code>y=X.loc[:, 'wheat_type']
</code></pre>

<p>when I ran the following command</p>

<pre><code>y['wheat_type'] = y.wheat_type("category").cat.codes
</code></pre>

<p>I got following error</p>

<blockquote>
  <p>'Series' object has no attribute 'wheat_type'</p>
</blockquote>

<p>on executing type(X),I got</p>

<pre><code> &lt;class 'pandas.core.frame.DataFrame'&gt;
</code></pre>

<p>and on executing type(y),I got</p>

<pre><code> &lt;class 'pandas.core.series.Series'&gt;
</code></pre>

<p>Is there possible way to covert y into a dataframe.If not,please tell me how to create required dataframe y from x</p>