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

Invalid dtypes should raise an error #5953

Closed
2 tasks done
kevinheavey opened this issue Dec 30, 2022 · 0 comments · Fixed by #5956
Closed
2 tasks done

Invalid dtypes should raise an error #5953

kevinheavey opened this issue Dec 30, 2022 · 0 comments · Fixed by #5956
Labels
bug Something isn't working python Related to Python Polars

Comments

@kevinheavey
Copy link

Polars version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Issue description

If you pass something that's not a dtype to pl.Series, it won't complain and will instead just ignore the dtype argument. This is probably not what we want, especially when people coming from pandas might try to do things like dtype="uint32".

The following example prints out:

shape: (2,)
Series: '' [i64]
[
        1
        2
]

Reproducible example

import polars as pl
print(pl.Series([1, 2], dtype="mayonnaise"))

Expected behavior

Raise an error.

Installed versions

---Version info---
Polars: 0.15.8
Index type: UInt32
Platform: Linux-5.15.85-1-MANJARO-x86_64-with-glibc2.36
Python: 3.11.0 | packaged by conda-forge | (main, Oct 25 2022, 06:24:40) [GCC 10.4.0]
---Optional dependencies---
pyarrow: 10.0.1
pandas: 1.5.2
numpy: 1.23.5
fsspec: 2022.11.0
connectorx: <not installed>
xlsx2csv: <not installed>
matplotlib: 3.6.2
@kevinheavey kevinheavey added bug Something isn't working python Related to Python Polars labels Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant