A few years ago, I needed "pivot" and resorted to short python
scripts. One example follows:
#!/usr/bin/python
#pyaay.py - prevalence by year and age to age and year, tail constant
from numpy import *
import xlrd
import csv
d=zeros ((7,41))
fn="prev.xls"
print fn;
book = xlrd.open_workbook(fn)
sh = book.sheet_by_index(1)
for a in range(1,8):
for y in range(1,18):
v=sh.cell_value(y,a)
d[a-1][y-1]=v
print "d[",a-1,",",y-1,"]=",v
for y in range(18,42):
d[a-1][y-1]=v
print "d[",a-1,",",y-1,"]=",v
writer = csv.writer(open("prev.csv", "wb"))
for a in range(7):
writer.writerow(d[a])
On Tue, May 8, 2012 at 6:07 AM, Jean Bréfort
<[email protected]> wrote:
> You might find some hints at
> http://projects.gnome.org/gnumeric/doc/sect-extending-python-console.shtml
>
> Regards,
> Jean
>
> Le lundi 07 mai 2012 à 15:37 +0700, Dr. Edward Scott a écrit :
>> With Visual Basic one can manipulate the value in a cell using:
>> Activecell.value = 24 for example. What statement in Python is used to
>> accomplish the same action? The Python manuals are silent on the matter
>> so far as I can tell and the gnumeric help offers no information that I
>> can discern.
>> [email protected]
>> _______________________________________________
>> gnumeric-list mailing list
>> [email protected]
>> http://mail.gnome.org/mailman/listinfo/gnumeric-list
>
>
> _______________________________________________
> gnumeric-list mailing list
> [email protected]
> http://mail.gnome.org/mailman/listinfo/gnumeric-list
--
Kindness Works!
Rev. Jim Tarvid, PCA
12897A Grays Pointe Road, Fairfax, Va 22033
703-657-0099 Condo
703-594-7297 Google Voice
877-465-7638 x4101
38.8778239, -77.392696
http://ls.net
_______________________________________________
gnumeric-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gnumeric-list