Converting pandas.core.series.Series to dataframe with appropriate column values python
<p>i'm running a function in which a variable is of pandas.core.series.Series type.</p>

<pre><code>type of the series shown below.

&lt;class 'pandas.core.series.Series'&gt;
product_id_y    1159730
count                 1
Name: 6159402, dtype: object
</code></pre>

<p>i want to convert this into a dataframe,such that, i get</p>

<pre><code>product_id_y    count
1159730           1
</code></pre>

<p>i tried doing this:</p>

<pre><code>series1 = series1.to_frame()
</code></pre>

<p>but getting wrong result</p>

<p>after converting to dataframe</p>

<pre><code>              6159402
product_id_y  1159730
count               1
</code></pre>

<p>after doing reset index i'e <code>series1 = series1.reset_index()</code></p>

<pre><code>           index  6159402
 0  product_id_y  1159730
 1         count        1
</code></pre>

<p>is there anny other way to do this??</p>