Skip to content

Implemented ndf.sort_values for nested columns #202

@hombit

Description

@hombit

Feature request

It would be really nice if we would have a simple and performant way to sort values inside nested frames. I think that we can reimplement sort_values allowing subcolumns with dot-notation. To not confuse user I'd allow single nested column per call.

Allow:

  • ndf.sort_values("a")
  • ndf.sort_values(["a", "b"])
  • ndf.sort_values("lc.time")
  • ndf.sort_values(["lc.band", "lc.time"])

Do not allow:

  • ndf.sort_values(["a", "lc.time"])
  • ndf.sort_values(["detections.time", "non_detections.band"])

The implementation would be something like this:

flat = ndf.lc.nest.to_flat()
flat = flat.sort_values([flat.index.name] + sort_subcolumns)
ndf.lc[:] = flat

Before submitting
Please check the following:

  • I have described the purpose of the suggested change, specifying what I need the enhancement to accomplish, i.e. what problem it solves.
  • I have included any relevant links, screenshots, environment information, and data relevant to implementing the requested feature, as well as pseudocode for how I want to access the new functionality.
  • If I have ideas for how the new feature could be implemented, I have provided explanations and/or pseudocode and/or task lists for the steps.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions