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

Combined extract decorator #121

Open
elijahbenizzy opened this issue Mar 22, 2023 · 0 comments
Open

Combined extract decorator #121

elijahbenizzy opened this issue Mar 22, 2023 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers refactor

Comments

@elijahbenizzy
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
We have two separate codepaths for extract_fields and extract_columns.

Furthermore, extract_fields requires one to write the type in the extract, but we should have that information in the fn output.

I think we can simplify the code quite a bit.

Describe the solution you'd like
A single extract (name TBD) decorator that does the following:

@extract("foo", "bar")
def foo_bar(foo: int, bar: int) -> Dict[str, int]:
    return {"foo": foo, "bar": bar}

@extract("foo", "bar")
def foo_bar(foo: pd.Series, bar: pd.Series) -> pd.DataFrame:
    return pd.DataFrame({"foo": foo, "bar": bar})

Then it can register "extensions" to allow for us to processing different extractions. E.G. different DF types, etc...

If its a Dict[str, foo], we know it'll be a bunch of foo type outputs. If its a pd.DataFrame we know its going to be pd.Series. Etc...

Describe alternatives you've considered
Not doing this.

Additional context
Just an idea that popped up when writing some new features.

@elijahbenizzy elijahbenizzy added enhancement New feature or request refactor labels Mar 22, 2023
@skrawcz skrawcz added the good first issue Good for newcomers label Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers refactor
Projects
None yet
Development

No branches or pull requests

2 participants