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

AttributeError: 'NoneType' object has no attribute 'x'[BUG] #175

Closed
2 tasks done
rleyvasal opened this issue Mar 9, 2023 · 4 comments
Closed
2 tasks done

AttributeError: 'NoneType' object has no attribute 'x'[BUG] #175

rleyvasal opened this issue Mar 9, 2023 · 4 comments
Labels
doc Improvements or additions to documentation

Comments

@rleyvasal
Copy link
Collaborator

rleyvasal commented Mar 9, 2023

datar version checks

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

  • I have confirmed this bug exists on the latest version of datar and its backends.

Issue Description

I am running the plotnine example on the repo page and I get an error message AttributeError: 'NoneType' object has no attribute 'x' when running the code below.

# works with plotnine
# example grabbed from https://github.com/has2k1/plydata

from datar import f  # this line not in the documentation

import numpy
from datar.base import sin, pi
from datar.tibble import tibble
from datar.dplyr import mutate, if_else
from plotnine import ggplot, aes, geom_line, theme_classic

df = tibble(x=numpy.linspace(0, 2 * pi, 500))
(
    df
    >> mutate(y=sin(f.x), sign=if_else(f.y >= 0, "positive", "negative"))
    >> ggplot(aes(x="x", y="y"))
    + theme_classic()
    + geom_line(aes(color="sign"), size=1.2)
)

Also, can you add from datar import f line of code to the the documentation example? - without it, the code does not run

Expected Behavior

Running the code show plotnine plot

Installed Versions

python : 3.8.12 (default, Oct 12 2021, 03:01:40) [MSC v.1916 64 bit (AMD64)] datar : 0.8.5 numpy : 1.22.3 pipda : 0.6.0 executing: 0.8.0 varname : 0.8.2 pandas : 1.4.1
@rleyvasal rleyvasal added the bug Something isn't working label Mar 9, 2023
@pwwang
Copy link
Owner

pwwang commented Mar 9, 2023

datar 0.8.5 is out of date. Can you try the latest version?

@rleyvasal
Copy link
Collaborator Author

It works in the latest version of datar, after running:

pip install -U datar
pip install -U datar[pandas]

Note: from datar import f line still needs to be added for the code to run.

@pwwang pwwang added doc Improvements or additions to documentation and removed bug Something isn't working labels Mar 9, 2023
@pwwang
Copy link
Owner

pwwang commented Mar 9, 2023

Mind submitting a PR?

@rleyvasal
Copy link
Collaborator Author

Submitted PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants