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

Create Hamilton converter for pandas code #28

Open
HamiltonRepoMigrationBot opened this issue Feb 26, 2023 · 4 comments
Open

Create Hamilton converter for pandas code #28

HamiltonRepoMigrationBot opened this issue Feb 26, 2023 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed migrated-from-old-repo Migrated from old repository product idea

Comments

@HamiltonRepoMigrationBot
Copy link
Collaborator

Issue by skrawcz
Friday May 13, 2022 at 22:54 GMT
Originally opened as stitchfix/hamilton#132


Is your feature request related to a problem? Please describe.
With Hamilton you need need to restructure your code. This can be too much of a friction point for someone. Wouldn't it be nice if we had a way to help automate this step?

Describe the solution you'd like
We should be able to write some python code that parses the AST to covert code like:

df['a'] = df['b'] + df['c']

into

def a(b: pd.Series, c: pd.Series) -> pd.Series:
      return b + c

Core to this problem, is building code to parse python code and output/print hamilton functions. Once we have that, we can think about the places we could provide this, e.g. CLI, a website, some other means...

Describe alternatives you've considered
Not doing this.

Additional context
It would enable people to get up and running with Hamilton faster. E.g. if they provided a script, and we "walked" the script and guessed what should be output...

@HamiltonRepoMigrationBot HamiltonRepoMigrationBot added enhancement New feature or request help wanted Extra attention is needed product idea labels Feb 26, 2023
@HamiltonRepoMigrationBot
Copy link
Collaborator Author

Comment by elijahbenizzy
Saturday Jun 04, 2022 at 21:34 GMT


Interesting... Another approach is to use some version of pandas that traces the actions and delays it (I bet koalas does something like this, or ibis), then use the intermediate data representation to compile to hamilton.

@HamiltonRepoMigrationBot
Copy link
Collaborator Author

Comment by elijahbenizzy
Saturday Oct 29, 2022 at 17:07 GMT


Started working on this -- got a rough POC working but its fairly complicated and wasn't worth my time.

What I'd love is doing this on the "intro to hamilton" web-page -- live conversion with an example we can get to. Will take another stab with my old prototype.

@elijahbenizzy
Copy link
Collaborator

OK, revisiting this, gpt-4 could be really good here... gpt-3.5 was able to do this decently...

@elijahbenizzy
Copy link
Collaborator

elijahbenizzy commented Dec 15, 2023

#583 gets this started

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed migrated-from-old-repo Migrated from old repository product idea
Projects
None yet
Development

No branches or pull requests

2 participants