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

Attribute Tab Completion for Pandas Series #249

Closed
wants to merge 3 commits into from

Conversation

tmastny
Copy link
Contributor

@tmastny tmastny commented Jul 8, 2020

This PR introduces potentially breaking changes to siuba, so it's further off than #248. However, I think this is really exciting and wanted to share this!

siuba-attr-complete

The main difference between this PR and #248 is that the output of Symoblic.__getattr__ is subclassed so it returns pandas.Series suggestions. Therefore, _ will provide completions based on the most recent dataframe and _.attribute will provide Series completions.

And since SymbolicAttr inherits (and is basically identical to) Symbolic, everything under the hood should work, but that's the part I need to do more digging into.

siuba/siuba/siu.py

Lines 664 to 671 in 0d6584c

def __getattr__(self, x):
# temporary hack working around ipython pretty.py printing
#if x == "__class__": return Symbolic
return SymbolicAttr(BinaryOp(
"__getattr__",
self.__source,
strip_symbolic(x)

siuba/siuba/siu.py

Lines 731 to 733 in 0d6584c

class SymbolicAttr(Symbolic):
def __dir__(self):
return dir(Series)

@tmastny tmastny requested a review from machow as a code owner July 8, 2020 13:44
@tmastny tmastny mentioned this pull request Jul 12, 2020
@tmastny
Copy link
Contributor Author

tmastny commented Jul 16, 2020

Based on the progress in #248 I don't think this is the right approach anymore. #248 also supports Series completion, which is the most important thing.

@tmastny tmastny closed this Jul 16, 2020
@tmastny tmastny deleted the attr_completion branch July 16, 2020 13:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant