Skip to content

Make it harder to pass a wrong column name to NestedFrame.reduce #240

@hombit

Description

@hombit

Feature request

One of the bugs I make in my code all the time is passing a wrong column name to NestedFrame.reduce(func, *args). This makes it a "constant" argument, instead of a variable value/array from the actual data frame. Sometimes this type of bug is hard to debug, for example when array of strings is expected (think about "lc.band").

It would be nice to find a way to make it harder to make such a mistake.

I see couple of options here:

  • Disallow all positional "constant" arguments: people may use **kwargs or lambda/partial if they must use *args
  • Disallow string positional arguments: more flexible, but may be a little bit more confusing for users (different behavior for different types of arguments)
  • Print a warning if a positional argument string doesn't match to any column, with a hint: string value "Xx" is passed, maybe you meant column "XX"?

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

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions