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

Missing attributes when chaining #204

Closed
grantmcdermott opened this issue Aug 11, 2022 · 5 comments · Fixed by #206
Closed

Missing attributes when chaining #204

grantmcdermott opened this issue Aug 11, 2022 · 5 comments · Fixed by #206
Labels
bug Something isn't working

Comments

@grantmcdermott
Copy link

grantmcdermott commented Aug 11, 2022

Hi Mark, thanks for putting this package together. It looks very cool.

I'm having a tough time getting the motivating examples to work, though. For example, the following triggers an error:

import tidypolars as tp
from tidypolars import col, desc

df = tp.Tibble(x = range(3), y = range(3, 6), z = ['a', 'a', 'b'])

df.filter(col('x') < 2).arrange(desc('z'), 'x')

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Untitled-1 in <cell line: 1>()
----> <a href='untitled:Untitled-1?line=7'>8</a> df.filter(col('x') < 2).arrange(desc('z'), 'x')

AttributeError: 'DataFrame' object has no attribute 'arrange'

What's genuinely odd about the above is that arrange works on its own and when it comes before filter.

# All of these work as expected
df.filter(col('x') < 2)
df.arrange(desc('z'), 'x')
df.arrange(desc('z'), 'x').filter(col('x') < 2)

A seemingly related issue is that I can't pass two arguments to filter when it follows arrange (or other verbs likeselect for that matter).

df.filter(col('x') < 2, col('y')>3) ## works
df.arrange(desc('z'), 'x').filter(col('x') < 2, col('y')>3) ## errors with "filter() takes 2 positional arguments but 3 were given"

Any ideas?

I'm on Python 3.9.2 installed via Homebrew on a 2019 Macbook (so regular Intel chip) and running the latest version of tidypolars (0.2.15).

@markfairbanks
Copy link
Owner

markfairbanks commented Aug 12, 2022

Thanks for catching this. Looks like polars made a change in v0.14.0 that broke tidypolars. I'll take a look and see if I can get it fixed sometime in the next couple days. In the meantime if you install a polars version >=0.13.44 and <0.14.0 everything should work fine.

This is one place where CRAN spoils R users. There is careful consideration for reverse dependencies so situations like this are exceedingly rare.

@markfairbanks markfairbanks added the bug Something isn't working label Aug 12, 2022
@markfairbanks
Copy link
Owner

PR that caused the break: pola-rs/polars#4309

Old behavior that tidypolars relied on: pola-rs/polars#2862

@grantmcdermott
Copy link
Author

Super, thanks for confirming and bisecting the error.

And a big amen for stable APIs ;-)

@markfairbanks
Copy link
Owner

@grantmcdermott you should be good to go now for tidypolars. I just sent a release to PyPi that requires polars <0.14.0. Thanks again for catching this.

I'm also planning on adding support for >=0.14.0. Here's the issue if you want to track there: #207

@grantmcdermott
Copy link
Author

Great, thanks Mark.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants