Giter Site home page Giter Site logo

Comments (6)

mwaskom avatar mwaskom commented on July 17, 2024

Are you sure you're using Pandas 0.12? I actually just ran into this problem today while testing against the Pandas 0.13 release candidate, but I think what you're doing should work with 0.12. In any case I was going to fix it and cut a version 0.2.1 in the next couple of days to address this and any other warts that pop up.

Here's a workaround, I think this is what the fix will look like too, just with lines 3 and 4 happening inside violinplot:

d = pd.Series(np.random.randn(100))
g = pd.Series(np.random.choice(list("abc"), 100))
gb = pd.groupby(d, g)
plot_data = [data for name, data in gb.groups.items()]
sns.violinplot(plot_data)

from seaborn.

olgabot avatar olgabot commented on July 17, 2024

Hmm on second thought I'm using the github master, which is closer to 0.13rc than 0.12. At first blush, it looks like that fix should work!

from seaborn.

mwaskom avatar mwaskom commented on July 17, 2024

I just pushed a fix to the v0.2 branch, give it a shot when you have a chance and let me know if it fixes your issue.

from seaborn.

olgabot avatar olgabot commented on July 17, 2024

Still no dice, I'm getting a KeyError here:

    261         groups = pd.groupby(vals, groupby).groups
--> 262         vals = [vals.reindex(groups[name]) for name in order]

It works if the vals line is:

[vals.reindex(groups[group]) for group in groups]

I did that plus some other miscellaneous xlabel and names fixes here: #53 but there might be some residual code from my previous attempt at violinplots.

from seaborn.

mwaskom avatar mwaskom commented on July 17, 2024

OK, I see what was wrong. The way I was doing things, it didn't recognize the dictionary style groupby object.

Because I didn't want to pile even more logic on top of the crappy duplicated code that set up the data for boxplot and violinplot, I ended up doing the long-awaited (#16) task of abstracting that code out into its own function and adding tests for it.

This now works on your data (Thanks Pandas :) ). By the way, I also transformed the data into tidy format (which is what I'm used to) to verify that the right thing was happening, in case that's useful.

from seaborn.

mwaskom avatar mwaskom commented on July 17, 2024

Closing this as I merged #54 (I merged in v0.2 for the bugfix released and cherry-picked the commits into master) but feel free to reopen if you test and it's still broken.

from seaborn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.