-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
pl.exclude(pl.first())
still isn't working
#13517
Comments
Isn't it expected that this raises? You can use |
|
It seems like perhaps the special cased column selector behaviour needs to go? As it stands, it basically cannot be combined with anything, it's not just an df.select(pl.col(pl.first()))
# TypeError: invalid input for `col`
df.drop(pl.first())
# TypeError: argument 'columns': 'Expr' object cannot be converted to 'PyString' |
As Marco pointed out, this should raise, as For further discussion on how selectors should work, please refer to #13757 |
Worth mentioning that this also doesn't work for >>> pl.DataFrame({'a': [1], 'b': [2]}).select(pl.all().exclude(pl.first()))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/michael/miniforge3/lib/python3.12/site-packages/polars/expr/expr.py", line 947, in exclude
raise TypeError(msg)
TypeError: invalid input for `exclude`
Expected one or more `str` or `DataType`; found <Expr ['nth(0)'] at 0x7F386B584A70> instead. |
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Log output
No response
Issue description
When I suggested supporting expressions and selectors in
pl.exclude
(#13247), my motivating example was thatpl.exclude(pl.first())
didn't work. Unfortunately, it still doesn't work after #13301, becausepl.exclude()
accepts selectors but not expressions.Expected behavior
pl.exclude(pl.first())
should be a valid expression or selector that excludes the first column.Installed versions
The text was updated successfully, but these errors were encountered: