I've been using Pandas data frames with scikit-learn for months without any
issues. Under the hood a Pandas column is a Series object which I believe
inherits from a Numpy type. If that doesn't work, consider adding ".values" to
the column specification like mydataframe['my column'].values
Of course, it might not be that simple depending on the vectorizer you are
using.
-- Ryan
From: Rob Zinkov <[email protected]<mailto:[email protected]>>
Reply-To:
"[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Date: Saturday, November 16, 2013 3:16 PM
To:
"[email protected]<mailto:[email protected]>"
<[email protected]<mailto:[email protected]>>
Subject: Re: [Scikit-learn-general] How to vectorize columns in a Pandas
dataframe?
You probably want
https://github.com/paulgb/sklearn-pandas<https://urldefense.proofpoint.com/v1/url?u=https://github.com/paulgb/sklearn-pandas&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=LFCGodllV6ePSYKIg3GW5g%3D%3D%0A&m=gy8rLt9gmgupzj%2BYwgLKXIsUQkAXZndtDy7ZHpG9M7w%3D%0A&s=41951884941524d8ac261328796fa967c0b300109b50b5578a1810f8f2332107>
this is will convert pandas dataframes into something sklearn likes.
On Sat, Nov 16, 2013 at 5:11 PM, Josh Wasserstein
<[email protected]<mailto:[email protected]>> wrote:
Say I have a dataframe in Pandas like the following:
> my_dataframe
col1, col2
A foo
B bar
C something
A foo
A bar
B foo
How can I vectorize this efficiently using DictVectorizer ?
Do I need to convert each entry above to a full dictionary? Is there a more
efficient way to do this?
Thanks,
Josh
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk<https://urldefense.proofpoint.com/v1/url?u=http://pubads.g.doubleclick.net/gampad/clk?id%3D63469471%26iu%3D/4140/ostg.clktrk&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=LFCGodllV6ePSYKIg3GW5g%3D%3D%0A&m=gy8rLt9gmgupzj%2BYwgLKXIsUQkAXZndtDy7ZHpG9M7w%3D%0A&s=4facfa7c8e0c217c69054d236d7316df6e6ce19e903e7abb77c43b03f02a3bb6>
_______________________________________________
Scikit-learn-general mailing list
[email protected]<mailto:[email protected]>
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general<https://urldefense.proofpoint.com/v1/url?u=https://lists.sourceforge.net/lists/listinfo/scikit-learn-general&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=LFCGodllV6ePSYKIg3GW5g%3D%3D%0A&m=gy8rLt9gmgupzj%2BYwgLKXIsUQkAXZndtDy7ZHpG9M7w%3D%0A&s=d4b0d3ac8bb88200367d1b4c8702f0657db9a4ff2bafe51226c34c435bc5645f>
------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general