chess: (Default)
There really should be a program for what I want to do:
Assign a list of numbers (positive and negative) I have in a CSV file to catagories (named with arbitary strings) whilst looking at a description of them also held in the CSV file
Easily generate a pie chart showing the total number in each catagory.

Currently I am doing it with a spreadsheet, which works but is kind of tedious as it doesn't have an 'okay, give me a total of everything in column Y where column X has the value Foo' function.

Date: 2004-10-04 03:10 pm (UTC)From: [identity profile] jaq.livejournal.com
I would have thought you could do that with a spreadsheet with some decent functions.

Date: 2004-10-04 03:57 pm (UTC)From: [identity profile] timeplease.livejournal.com
Python script using the csv and pychart libraries?

Date: 2004-10-04 06:32 pm (UTC)From: [identity profile] requiem-17-23.livejournal.com
Excel has such abilities. Use its data filtering tool for column X value Foo, then simply select column Y and sum it.

Date: 2004-10-04 11:55 pm (UTC)From: [identity profile] hatter.livejournal.com
It's called a 'database'. In addition to the python/pychart, suggestion, there's also the perl way, with DBD::CSV to talk sql at it like any other db. Or a few lines of bash, a dose of sort/split/uniq, and back to excel with the trivially graphable results.


the hatter

Date: 2004-10-05 07:38 am (UTC)From: [identity profile] ringbark.livejournal.com
Doesn't Excel's SUMIF function do this?
I can't remember the order exactly, but it's something like
=SUMIF(A1,Sheet1!X:X,Sheet1!Y:Y) would look up in column X everything that contained what was in A1 and add up the totals in column Y that matched. If you just wanted to count them, you'd use COUNTIF. Is this what you meant?

Date: 2004-10-06 07:41 pm (UTC)From: [identity profile] theinquisitor.livejournal.com
Create foo.pl as below:

#! /usr/bin/perl
while(<>=~/^(.*?),(.*)\n$/){$v{$1}+=$2;}
print $v;

Then

cat bah | ./foo.pl | [Command-line pi chart generator of choice]

Obviously, you may need to adapt the regexp slightly.

Profile

chess: (Default)
Michelle Taylor

January 2025

S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jan. 2nd, 2026 05:50 pm
Powered by Dreamwidth Studios