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

[QST] Warning: PipeableCallCheckWarning: Failed to detect AST node calling mutate, assuming a piping call. #196

Closed
luifrancgom opened this issue Dec 6, 2023 · 6 comments
Labels
question Further information is requested raw python repl Issues with piping syntax in raw python REPL

Comments

@luifrancgom
Copy link

luifrancgom commented Dec 6, 2023

Question about datar

When I run the following code

# with pandas backend
from datar import f
from datar.dplyr import mutate
from datar.tibble import tibble
# or
# from datar.all import f, mutate, filter, if_else, tibble

df = tibble(
    x=range(4),  # or c[:4]  (from datar.base import c)
    y=['zero', 'one', 'two', 'three']
)
df >> mutate(z=f.x)

I get the following warning PipeableCallCheckWarning: Failed to detect AST node calling mutate, assuming a piping call.
I want to understand what is the meaning of this warning.

My session info is the following:

-----
datar               0.15.3
datar_pandas        0.5.3
pipda               0.13.1
session_info        1.0.0
-----
Python 3.10.9 (main, Mar  1 2023, 18:23:06) [GCC 11.2.0]
Linux-6.2.0-37-generic-x86_64-with-glibc2.35
-----
Session information updated at 2023-12-06 13:49

Also when I run datar.get_versions() this is the information I get:

python      : 3.10.9 (main, Mar  1 2023, 18:23:06) [GCC 11.2.0]
datar       : 0.15.3
simplug     : 0.3.2
executing   : 2.0.1
pipda       : 0.13.1
datar-numpy : 0.3.2
numpy       : 1.26.2
datar-pandas: 0.5.3
pandas      : 2.1.1
@luifrancgom luifrancgom added the question Further information is requested label Dec 6, 2023
@pwwang
Copy link
Owner

pwwang commented Dec 7, 2023

What's the environment where you ran your code, python file, python REPL, ipython, jupyter, etc?

@luifrancgom
Copy link
Author

I am using Visual Studio Code version 1.84.2 (user setup) and running it in a conda environment.

@pwwang
Copy link
Owner

pwwang commented Dec 7, 2023

Did you run it from a Python REPL (by typing "python" from the command line and running you code from there)?

@luifrancgom
Copy link
Author

I am going to reproduce what I exactly did and also I attach a screenshot. I apologize in advance if the problem is not related to the module.

luifrancgom@luifrancgom-HP-Compaq-6200-Pro-SFF-PC:~/Documents$ conda activate base
(base) luifrancgom@luifrancgom-HP-Compaq-6200-Pro-SFF-PC:~/Documents$ python
Python 3.10.9 (main, Mar  1 2023, 18:23:06) [GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datar import f
>>> from datar.dplyr import mutate
>>> from datar.tibble import tibble
>>> df = tibble(
...     x=range(4),  # or c[:4]  (from datar.base import c)
...     y=['zero', 'one', 'two', 'three']
... )
>>> df >> mutate(z=f.x)
/home/luifrancgom/anaconda3/lib/python3.10/site-packages/pipda/utils.py:89: PipeableCallCheckWarning: Failed to detect AST node calling `mutate`, assuming a piping call.
  warnings.warn(
        x        y       z
  <int64> <object> <int64>
0       0     zero       0
1       1      one       1
2       2      two       2
3       3    three       3

Screenshot from 2023-12-07 08-02-31

@pwwang pwwang added the raw python repl Issues with piping syntax in raw python REPL label Dec 7, 2023
@pwwang
Copy link
Owner

pwwang commented Dec 7, 2023

You are running code via raw Python REPL. See issues under:

https://github.com/pwwang/datar/issues?q=label%3A%22raw+python+repl%22+

Try to use ipython or save your code in a script and run it with python xxx.py.

Or you can also temporarily dismiss the warning by:

df >> mutate(z=f.x, __ast_fallback="piping")

@luifrancgom
Copy link
Author

Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested raw python repl Issues with piping syntax in raw python REPL
Projects
None yet
Development

No branches or pull requests

2 participants