Open
Description
Found this when working on
import pandas as pd
d = {'one' : ['A', 'A', 'B', 'B', 'C'],
'two' : [4., 3., 2., 2, 1],
'three' : [10., 8., 3, 5, 7.]}
df = pd.DataFrame(d)
# this works
df.hist('two', by='one', bins=range(0, 10))
# this does not work (everything in one plot), also no way to specify column
df.plot.hist(by='one', bins=range(0, 10))
My idea was to make the df.plot.hist version similar to the df.hist. But the code is much more complex. Would it not be best to point the df.plot.hist to the df.hist version? Instead of having two separate logics for this?
Oh, and the by keyword does not seem to work for df.plot.box, have not found any it worked for. At least the way I expected it to work :)
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
sinhrks commentedon Oct 31, 2015
Related to #8018 (internally it splits data to groups).
by
behaves differently indf.hist
(subplots) anddf.box
(grouping in a sincle ax). Thus, I don't think porting these behavior toplot
is not good idea. We should decide howby
should work.Twizzledrizzle commentedon Oct 31, 2015
Oh! I missed your work completely when looking through the pull requests. It looks really nice.
I did not know about the groupby().hist, or groupby().plot.hist. I guess I would expect if having the by-keyword, we would get the same results.
Also, can you take a look at my pull request: #11441
I am trying to get a better implementation of the weighs keyword, and also work even though you have different nan's in the data & weights. But if this could be integrated in your solution I would be sooo happy
For example
and when plotting multiple data, perhaps like below
Twizzledrizzle commentedon Oct 31, 2015
And plotted in the same graph, if not your new keyword
subplots=True
is used?Twizzledrizzle commentedon Nov 1, 2015
@sinhrks I tried to pull your changes into my own dev environment to test out various things with weighs, but alas I failed :(
I did not find your group by repository. Can you publish it again? It would be really really fun trying your great looking additions out in the hope I can contribute a little back.