<div dir="ltr"><span style="color:rgb(36,39,41);font-family:arial,'helvetica neue',helvetica,sans-serif;font-size:15px;line-height:19px"> you can use </span><a href="http://pandas.pydata.org/pandas-docs/stable/generated/pandas.get_dummies.html" rel="nofollow" style="margin:0px;padding:0px;border:0px;font-size:15px;color:rgb(0,89,153);text-decoration:none;font-family:arial,'helvetica neue',helvetica,sans-serif;line-height:19px"><code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap">pandas.get_dummies()</code></a><span style="color:rgb(36,39,41);font-family:arial,'helvetica neue',helvetica,sans-serif;font-size:15px;line-height:19px">. It will perform one hot encoding on categorical columns, and produce a dataframe as the result. From there you can use </span><code style="margin:0px;padding:1px 5px;border:0px;font-size:13px;font-family:consolas,menlo,monaco,'lucida console','liberation mono','dejavu sans mono','bitstream vera sans mono','courier new',monospace,sans-serif;background-color:rgb(239,240,241);white-space:pre-wrap;color:rgb(36,39,41)">pandas.concat([existing_df, new_df],axis=0)</code><span style="color:rgb(36,39,41);font-family:arial,'helvetica neue',helvetica,sans-serif;font-size:15px;line-height:19px"> to add the new columns to your existing dataframe. This will avoid the use of a numpy array.</span><br><div><span style="color:rgb(36,39,41);font-family:arial,'helvetica neue',helvetica,sans-serif;font-size:15px;line-height:19px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Dec 7, 2016 at 8:44 AM, Nilay Shrivastava <span dir="ltr"><<a href="mailto:nilay.euler16@gmail.com" target="_blank">nilay.euler16@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div dir="auto" style="font-family:sans-serif;font-size:13.696px">StandardScaler returns numpy array even if the object passed is a pandas dataframe, shouldn't it return a dataframe? </div><br></div>
<br>______________________________<wbr>_________________<br>
scikit-learn mailing list<br>
<a href="mailto:scikit-learn@python.org">scikit-learn@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/scikit-learn" rel="noreferrer" target="_blank">https://mail.python.org/<wbr>mailman/listinfo/scikit-learn</a><br>
<br></blockquote></div><br></div>