Closed sibananda-dream11 closed 1 year ago
Could you provide a copy of minimal runnable code, as well as the full version information?
from datar.all import *
from datar import f
import pandas as pd
from sklearn import datasets as dt
ir = dt.load_iris(as_frame=True)
ir >> group_by(f.target)
I am getting error with this. Sorry it may be a basic error but i don't know how to make it run.
The ir
data you loaded is a dict:
>>> ir.keys()
# dict_keys(['data', 'target', 'frame', 'target_names', 'DESCR', 'feature_names', 'filename', 'data_module'])
You should refer to the frame
dataframe:
>>> from datar.all import *
>>> from datar import f
>>> import pandas as pd
>>> from sklearn import datasets as dt
>>>
>>> ir = dt.load_iris(as_frame=True)
>>> ir['frame'] >> group_by(f.target)
sepal length (cm) sepal width (cm) petal length (cm) petal width (cm) target
<float64> <float64> <float64> <float64> <int64>
0 5.1 3.5 1.4 0.2 0
1 4.9 3.0 1.4 0.2 0
2 4.7 3.2 1.3 0.2 0
3 4.6 3.1 1.5 0.2 0
.. ... ... ... ... ...
4 5.0 3.6 1.4 0.2 0
145 6.7 3.0 5.2 2.3 2
146 6.3 2.5 5.0 1.9 2
147 6.5 3.0 5.2 2.0 2
148 6.2 3.4 5.4 2.3 2
149 5.9 3.0 5.1 1.8 2
[150 rows x 5 columns]
[TibbleGrouped: target (n=3)]
By the way, you also need datar-pandas
backend to be installed:
pip install -U datar[pandas]
# or
pip install -U datar-pandas
datar version checks
[X] I have checked that this issue has not already been reported.
[X] I have confirmed this bug exists on the latest version of datar and its backends.
Issue Description
Getting this error on trying to use any function(group_by,filter) from datar. ContextError: Cannot evaluate
ReferenceAttr
object without a contextExpected Behavior
Should have been running coreectly without any error.
Installed Versions