Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion of existing strings to sets #1

Open
tehfink opened this issue Dec 27, 2018 · 1 comment
Open

Conversion of existing strings to sets #1

tehfink opened this issue Dec 27, 2018 · 1 comment

Comments

@tehfink
Copy link

tehfink commented Dec 27, 2018

Very cool project!
What's the recommended method to convert an existing dataframe with a string of tags to your sets? e.g.:

In [1]: tag_df.head()                                                                                                          
Out[1]: 
                             tags
ID                                                   
19263262153                  tag1, tag 2, tag 3, tag4,...
@Florents-Tselai
Copy link
Owner

I'm glad you liked it!

The package expects that Series objects (DataFrame columns as well) already store set objects - no implicit conversions there. So you should convert strings to sets first.
Something like

df = DataFrame([{"tags": "t1,t2"}])

df.tags.str.split(",").map(set).set.union({"t3"})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants