-
Notifications
You must be signed in to change notification settings - Fork 1
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
Unconditional summary stats results on numerical data: margin case #156
Comments
👀 |
After some inspection, please try |
Additionally, you can try the following:
because that should include the "missings" of the opposite dimension, and thus be "unconditional". @malecki can you comment (if I'm right or wrong)? P.S. - results are from a different dataset than the one you used, lest there be confusion about the numbers... |
Thanks for this @slobodan-ilic. I am not at work today, but from what I see above I guess there is a misunderstanding (probably due to my initial phrasing of the issue) about the "margin result": What we are after in this case is the "margin mean", i.e. the mean across all cases that contain valid data for |
To add to my comment from above, here is the docstring from the
We would need a numeric data equivalent here. |
I don't think the So the solution here (and I've confirmed this with @malecki ), is to just make an additional request of what you want from the server. The same way you'd have to do it in our web client. So for the case that I've used, it would be something like (just use it without the
|
Hm... I've just figured out that the |
Ha! I did not even know that this is possible (I tried to simply fetch an "empty" cube but I think I passed If this result is simply not obtainable server-sided this is perfectly fine and we should not dig any deeper. This issue came up looking at the interface from a consistency perspective. #157 (which should be solved by the code above) constituted a real blocker. Thanks @slobodan-ilic and @malecki for looking at that so quickly! @jamesrkg: Agree to simply close and let both issues rest for now once I cheked against Rogo's deck / dataset? |
We’re planning some work to improve how numeric variables are dealt with, in particular in multitables where the approach already is the unconditional row variable as the first subcube, followed by whatever other conditioning column variables. It is not currently possible to request the measure cube_mean of numerics via the multitable export endpoint at all, and the first task will be to remedy that. |
Is there any way I can get the margin result for a 2D cube (first dimensions being a numerical variable, crossed by a categorical), i.e. the mean of all cases with non-empty data for the two dimensions? I am unable to find something that works like
cube.measures.scale_means.ScaleMeans.margin()
method for numerical data.Example setup:
Setting up the measure for the mean:
Then using
pycrunch.cubes.fetch_cube
and theCrunchCube
api to query the results from Crunch:Which gives me:
I guess the 1D structure of that cube would cause a
margin()
result to fail anyway? Which leads to the related question of how I would get unconditional / 1D statistics on numerical data in general: #157The text was updated successfully, but these errors were encountered: