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

TimeDelta sum #1029

Closed
oplatek opened this issue May 3, 2019 · 3 comments
Closed

TimeDelta sum #1029

oplatek opened this issue May 3, 2019 · 3 comments
Labels

Comments

@oplatek
Copy link

oplatek commented May 3, 2019

Hi!

Thank you for csvkit.
I am wondering if it would be possible to add the "sum feature" for TimeDelta type?

How would I use it?

$ csvstat -c Duration --unique test.csv
2

$ csvstat -c Duration --sum test.csv
None   # Here I would expect 4:06:00 instead of None -- sum of the time delta times

$ cat test.csv
Duration
01:16:00
02:50:00

I am happy to submit PR.

Thanks

@jpmckinney
Copy link
Member

Yes, PR welcome! I don't know if agate already supports summing of TimeDelta. If not, you'll have to add it there first, and then update csvkit.

@dannysepler
Copy link
Contributor

Yes, PR welcome! I don't know if agate already supports summing of TimeDelta. If not, you'll have to add it there first, and then update csvkit.

This seemed right! The underlying fix was to support it in agate, which was done here: wireservice/agate#735

How do we update csvkit now? Or does that happen automatically?

@jpmckinney
Copy link
Member

Yes, if the latest version of agate is installed, it will work!

echo "Duration
01:16:00
02:50:00" | csvstat -c Duration --sum
# 4:06:00

Thanks for the PR in agate!

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

No branches or pull requests

3 participants