markfairbanks / tidypolars

Tidy interface to polars
http://tidypolars.readthedocs.io
MIT License
321 stars 10 forks source link

`AttributeError: arrange not found` #140

Closed ztsweet closed 2 years ago

ztsweet commented 2 years ago
import tidypolars as tp
from tidypolars import col, desc
import sys
sys.version
# '3.10.0 | packaged by conda-forge | (default, Oct 12 2021, 21:24:52) [GCC 9.4.0]'
tp.__version__
# '0.2.1'
df = tp.Tibble({'x': ['a', 'a', 'b'], 'y': range(3)})
df.arrange('x', 'y')
`
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
~/miniconda3/envs/py310/lib/python3.10/site-packages/polars/eager/frame.py in __getattr__(self, item)
    882         try:
--> 883             return pl.eager.series.wrap_s(self._df.column(item))
    884         except RuntimeError:

RuntimeError: Any(NotFound("arrange"))

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
/tmp/ipykernel_21110/1194586334.py in <module>
----> 1 df.arrange('x', 'y')

~/miniconda3/envs/py310/lib/python3.10/site-packages/polars/eager/frame.py in __getattr__(self, item)
    883             return pl.eager.series.wrap_s(self._df.column(item))
    884         except RuntimeError:
--> 885             raise AttributeError(f"{item} not found")
    886 
    887     def __iter__(self) -> Iterator[Any]:

AttributeError: arrange not found
`
markfairbanks commented 2 years ago

Does this issue still occur with python 3.9? This works fine when I run it.

ztsweet commented 2 years ago

it works fine with python 3.9 @markfairbanks

markfairbanks commented 2 years ago

Interesting - I’ll see if I can figure out what’s going on with 3.10 that would cause this.

For now I would recommend using 3.9 with tidypolars

markfairbanks commented 2 years ago

This works for me on 3.10 on macOS.

@mjkarlsen - does this work for you?

mjkarlsen commented 2 years ago

It works for me on 3.10 on Ubuntu.

import tidypolars as tp
from tidypolars import col, desc
import sys

print(sys.version)
print(tp.__version__)
df = tp.Tibble({'x': ['a', 'a', 'b'], 'y': range(3)})
df.arrange('x', 'y')

3.10.0 (default, Nov 10 2021, 11:24:47) [Clang 12.0.0 ]
0.2.1
shape: (3, 2)
┌─────┬─────┐
│ x   ┆ y   │
│ --- ┆ --- │
│ str ┆ i64 │
╞═════╪═════╡
│ a   ┆ 0   │
├╌╌╌╌╌┼╌╌╌╌╌┤
│ a   ┆ 1   │
├╌╌╌╌╌┼╌╌╌╌╌┤
│ b   ┆ 2   │
└─────┴─────┘
markfairbanks commented 2 years ago

@ztsweet - I'm going to close this for now. We can keep trouble shooting here and see if we can get it to work. I think you might just need to start with a clean environment.