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

base.sprintf() not working with Series as arguments #102

Closed
pwwang opened this issue Mar 29, 2022 · 1 comment
Closed

base.sprintf() not working with Series as arguments #102

pwwang opened this issue Mar 29, 2022 · 1 comment
Labels
bug Something isn't working priority High priority

Comments

@pwwang
Copy link
Owner

pwwang commented Mar 29, 2022

>>> from datar.base import sprintf
>>> from datar.tibble import tibble
>>> 
>>> df = tibble(x=[1, 2, 3])
>>> sprintf("%03d", 1)
array(['001'], dtype=object)
>>> sprintf("%03d", df.x)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    sprintf("%03d", df.x)
  File "/home/pwwang/github/pipda/pipda/register.py", line 484, in wrapper
    return calling_rule(generic, args, kwargs, envdata, verb_arg_only)
  File "/home/pwwang/github/pipda/pipda/_calling.py", line 186, in ndfunc_calling_rule2
    return generic(*args, **kwargs)
  File "/home/pwwang/github/datar/datar/core/factory.py", line 348, in _pipda_func
    out = dispatched(*bound.args, **bound.kwargs)
  File "/home/pwwang/miniconda3/lib/python3.9/functools.py", line 877, in wrapper
    return dispatch(args[0].__class__)(*args, **kw)
  File "/home/pwwang/github/datar/datar/core/factory.py", line 174, in _dispatched
    return _apply_meta(
  File "/home/pwwang/github/datar/datar/core/factory.py", line 144, in _apply_meta
    raise ValueError(f"{exc} (registered function: {qualname})") from exc
ValueError: Transform function failed (registered function: sprintf)

R:

r$> library(tibble)                                                                                   

r$> df = tibble(x=1:3)                                                                                

r$> sprintf("%03d", 1)                                                                                
[1] "001"

r$> sprintf("%03d", df$x)                                                                             
[1] "001" "002" "003"
@pwwang pwwang added bug Something isn't working priority High priority labels Mar 29, 2022
@pwwang pwwang mentioned this issue Apr 7, 2022
pwwang added a commit that referenced this issue Apr 7, 2022
* 🐛 Fix base.sprintf() not working with Series (#102)

* 🩹 Typos in argument names of tidyr.pivot_longer() (#104)

* ✨ Allow tidyr.unite() to unite multiple columns into a list, instead of join them (#105)

* 🔖 0.7.2

* 🩹 Use agg() instead of apply in base.sprintf()
@pwwang
Copy link
Owner Author

pwwang commented Apr 7, 2022

Fix at 0.7.2

@pwwang pwwang closed this as completed Apr 7, 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 priority High priority
Projects
None yet
Development

No branches or pull requests

1 participant