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

docs for groupindices has wrong example #3210

Closed
floswald opened this issue Oct 28, 2022 · 3 comments
Closed

docs for groupindices has wrong example #3210

floswald opened this issue Oct 28, 2022 · 3 comments

Comments

@floswald
Copy link
Contributor

hi,

I found here https://dataframes.juliadata.org/stable/lib/functions/#DataFrames.groupindices that i cannot run the example:

julia> df = DataFrame(id=["a", "c", "b", "b", "a"])
julia> gdf = groupby(df, :id);
julia> combine(gdf, groupindices)
ERROR: MethodError: no method matching groupindices(::SubDataFrame{DataFrame, DataFrames.Index, Vector{Int64}})
Closest candidates are:
  groupindices(::GroupedDataFrame) at ~/.julia/packages/DataFrames/JZ7x5/src/groupeddataframe/groupeddataframe.jl:359
Stacktrace:
@bkamins
Copy link
Member

bkamins commented Oct 28, 2022

You are using a documentation for DataFrames.jl 1.4.2, while you are testing the code under some other version of DataFrames.jl (it is hard for me to identify it as I do not have this version installed so could you please check the version you use?).

@bkamins bkamins closed this as completed Oct 28, 2022
@bkamins
Copy link
Member

bkamins commented Oct 28, 2022

This is the output I get on DataFrames.jl 1.4.2:

julia> df = DataFrame(id=["a", "c", "b", "b", "a"])
5×1 DataFrame
 Row │ id
     │ String
─────┼────────
   1 │ a
   2 │ c
   3 │ b
   4 │ b
   5 │ a

julia> gdf = groupby(df, :id);

julia> combine(gdf, groupindices)
3×2 DataFrame
 Row │ id      groupindices
     │ String  Int64
─────┼──────────────────────
   1 │ a                  1
   2 │ c                  2
   3 │ b                  3

@floswald
Copy link
Contributor Author

indeed i was on v1.3.6! sorry about that, should make a habit of checking for version.

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