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

[agg-sum] sum() takes no keyword arguments #2013

Closed
geekscrapy opened this issue Aug 29, 2023 · 10 comments
Closed

[agg-sum] sum() takes no keyword arguments #2013

geekscrapy opened this issue Aug 29, 2023 · 10 comments

Comments

@geekscrapy
Copy link
Contributor

Small description
sum aggregator no longer working. when applied to a column and a freq sheet is opened you get the following error in the sum agg col: sum() takes no keyword arguments

Expected result
sum aggregation on columns

Actual result with screenshot

Traceback (most recent call last):
  File "/Users/geekscrapy/envs/py37/lib/python3.7/site-packages/visidata/threads.py", line 200, in _toplevelTryFunc
    t.status = func(*args, **kwargs)
  File "/Users/geekscrapy/envs/py37/lib/python3.7/site-packages/visidata/aggregators.py", line 183, in memo_aggregate
    dispval = col.format(typedval)
  File "/Users/geekscrapy/envs/py37/lib/python3.7/site-packages/visidata/column.py", line 229, in format
    return self.make_formatter()(*args, **kwargs)
  File "/Users/geekscrapy/envs/py37/lib/python3.7/site-packages/visidata/column.py", line 209, in _format_len
    return self.formatValue(typedval, **kwargs)
  File "/Users/geekscrapy/envs/py37/lib/python3.7/site-packages/visidata/column.py", line 244, in formatValue
    return vd.getType(self.type).formatter(self.fmtstr, typedval)
  File "/Users/geekscrapy/envs/py37/lib/python3.7/site-packages/visidata/type_floatsi.py", line 10, in SIFormatter
    while abs(val) > 1000:
TypeError: bad operand type for abs(): 'TypedWrapper'

Steps to reproduce with sample data and a .vd

echo -e "A,B,C\n1,2,3" | vd -f csv -N
z+, sum
@geekscrapy geekscrapy added the bug label Aug 29, 2023
@anjakefala
Copy link
Collaborator

Oh, thank you!

It is related to this: #2009 which is related to 1c466d8. I will take a look soon.

@anjakefala
Copy link
Collaborator

@geekscrapy, I am a bit confused. =(

Are you sure about this stacktrace? Were the values typed as type-floatsi before summed? Which commit are you on? Could you give me a gif or series of screenshots?

When I try it on 9ec71f3 I cannot reproduce. I also cannot with #2009. I am using type-int. I also cannot reproduce with type-floatsi.

@geekscrapy
Copy link
Contributor Author

geekscrapy commented Aug 30, 2023

Are you sure about this stacktrace? Were the values typed as type-floatsi before summed?

Yes, they were.

Tbh, I thought I was on the latest commit but it appears my update func failed. I'll update again and retest

@geekscrapy
Copy link
Contributor Author

geekscrapy commented Aug 30, 2023

Just realised why it didn't update, you are no longer supporting 3.7 °-° !

Yup, this now works... Sorry, hadn't noticed the version req

@anjakefala
Copy link
Collaborator

Oh wow!

Was it a big deal for you to update Python versions?

@geekscrapy
Copy link
Contributor Author

geekscrapy commented Aug 31, 2023

Massive, I have a massive amount of cli tools that work with different versions of python, and some silently break of not setup correctly.
In the end I just created a new VM and retested.
But for now I've had to roll back the VD version to 4ffacbb on my main host, and it looks like I'll be stuck there for a while as the tool I use vd within doesn't take well to updates 🥴
Hopefully building a new system soon where I can sort out the python envs again, it's a cyclical process 🤷‍♂️

(FWIW, I love this commit, a few great features and feels solid)

@anjakefala
Copy link
Collaborator

Ah, I'm sorry it caught you by surprise! =( I tried to advertise this in a few places: #2004

FWIW, we are not making any grand migration to Python 3.8 exclusive code, other than sum(start=). So if you are comfortable with git, you can grab newer stuff that you like. I will keep this in mind when you submit bug reports!

@anjakefala
Copy link
Collaborator

Hey @geekscrapy!

We really value all of your contributions to VisiData, so we reintroduced Python 3.7 support.

I would still get yourself upgraded as soon as possible for a bundle of reasons!

@geekscrapy
Copy link
Contributor Author

Ha ha, thanks! I shall update (vd) immediately 😏 but yes, in going to skip to py12 and be done with it for a year or so !

@anjakefala
Copy link
Collaborator

@geekscrapy LMK when you do. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants