-
Notifications
You must be signed in to change notification settings - Fork 126
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
Dialyzer complains about ungroup
with no colum names
#1055
Comments
Great demo of the issue, thanks! @philss I believe adding @spec ungroup(
df :: DataFrame.t(),
groups_or_group :: column_names() | column_name() | Range.t()
) ::
DataFrame.t()
def ungroup(df, groups \\ ..) But I'm also wondering if we even want Apologizes if the reasoning behind |
Can we access group by index anywhere? I don't think we can, so I would agree we should not support ranges. Maybe introduce |
@josevalim I think the original #1035 was about removing |
So I'd say: let's support ranges even though it probably would have very little application in practice. At least it is consistent with all other APIs that accept column names. |
I think we can make that work. One complication though: does the range represent the column indices or the group indices? For import Explorer.DataFrame
df = new(a: [1, 1, 1], b: [2, 2, 2], c: [3, 3, 3])
grouped = group_by(df, 1..2) # groups by [:b, :c]
ungrouped = ungroup(df, 0..1) # ungroups [:b, :c] or just [:b]? |
Gut feeling says it applies to groups, don't groups become the first columns once ungrouped anyway? |
I agree. Otherwise you'd have to find the location of the grouped column in
It doesn't appear so. iex> import Explorer.DataFrame
Explorer.DataFrame
iex> df = new(a: [1, 1, 1], b: [2, 2, 2], c: [3, 3, 3])
#Explorer.DataFrame<
Polars[3 x 3]
a s64 [1, 1, 1]
b s64 [2, 2, 2]
c s64 [3, 3, 3]
>
iex> grouped = group_by(df, 1..2) # groups by [:b, :c]
#Explorer.DataFrame<
Polars[3 x 3]
Groups: ["b", "c"]
a s64 [1, 1, 1]
b s64 [2, 2, 2]
c s64 [3, 3, 3]
>
iex> ungrouped = ungroup(df, ..)
#Explorer.DataFrame<
Polars[3 x 3]
a s64 [1, 1, 1]
b s64 [2, 2, 2]
c s64 [3, 3, 3]
>
iex> ungrouped.names
["a", "b", "c"] |
Sounds good then with groups only! |
@viniciussbs If you're able, please double check that this actually got fixed on main. Thanks! |
@billylanchantin So, This didn't compile: {:explorer,
git: "https://github.com/elixir-explorer/explorer.git",
branch: "main",
submodules: true} Then I've tried this suggestion from README, but it didn't compile: {:explorer,
git: "https://github.com/elixir-explorer/explorer.git",
branch: "main",
submodules: true,
system_env: %{"EXPLORER_BUILD" => "1"}},
{:rustler, ">= 0.0.0"} Then I installed Rust via
Am I doing something wrong or does it take too long to compile? Also, should the REAME mention that the developer needs Rust/cargo installed? I believed |
@viniciussbs Thanks for checking!
I seem to recall long compile times for the first compile too 😬
Yes it's mentioned in the contributing guidelines: https://github.com/elixir-explorer/explorer?tab=readme-ov-file#contributing. Though I do apologize, I forgot that this would all be required for you to check that this was fixed on If it keeps giving you trouble please don't feel like you need to persevere! I'm pretty sure the situation is fixed, I was just hoping for a double check. But it's not necessary :) |
@billylanchantin forgot to mention here, but it compiled.
After that,
|
Hi! I've mentioned in a closed issue about
ungroup
that I was experiencing an error when callingungroup
with no column names. But actually, the issue is different: it works, but Dialyzer complains about it.The issue
This works:
But Dialyzer complains:
Then you pass column names in
ungroup
:And Dialyzer stops complaining:
Repo reproducing the issue:
https://github.com/viniciussbs/explorer-app/tree/ungroup-and-dialyzer
The text was updated successfully, but these errors were encountered: