Skip to content

Feature request: Group data frames to accept string or symbol as index when grouping is by a single attribute #3470

Open
@alex-s-gardner

Description

@alex-s-gardner

#Make example grouped data frame

using DataFrames
df=DataFrame(city=["Paris", "London", "Paris", "Berlin", "London", "Berlin", "Berlin"],  
             date= ["10-1$k-2021"  for k in 3:9],
             v=38 .+100*rand(7))
gdf = DataFrames.groupby(df, :city)

this is how the data frame needs to be accessed now:

gdf[("Berlin", )]

for a data frame grouped by a single attribute it would be more intuitive to simply index in the same was as a data frame column

gdf["Berlin"] == gdf[:Berlin] ==  gdf[("Berlin", )]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions