[Python] convertire fogli xls in csv

2012-02-14 Per discussione Riccardo mancuso
ciao ragazzi,
vorrei creare uno script .py che:
1. apra un file xls
2. selezioni 2 fogli (di cui conosco il nome)
3. salvi i 2 fogli in formato .csv

Consigli ?
Che libreria usereste ?
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] convertire fogli xls in csv

2012-02-14 Per discussione Vittorio Zuccala'
Per leggere e scrivere xls:
http://www.python-excel.org/

Per i CSV ti mando questo documento che avevo fatto per un corso magari può
esserti utile:
http://is.gd/PythonCSV

2012/2/14 Riccardo mancuso mancuso.riccard...@gmail.com

 ciao ragazzi,
 vorrei creare uno script .py che:
 1. apra un file xls
 2. selezioni 2 fogli (di cui conosco il nome)
 3. salvi i 2 fogli in formato .csv

 Consigli ?
 Che libreria usereste ?


 ___
 Python mailing list
 Python@lists.python.it
 http://lists.python.it/mailman/listinfo/python




-- 
Blog:http://zuccala.blogspot.com/
Twitter: http://twitter.com/#!/VittorioZuccala/
Buzz:   http://www.google.com/profiles/nathanvi#buzz
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] convertire fogli xls in csv

2012-02-14 Per discussione Marco Mariani
http://pypi.python.org/pypi/xlrd
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


Re: [Python] convertire fogli xls in csv

2012-02-14 Per discussione Riccardo mancuso
grazie per i suggerimenti.
ho trovato anche un interessante script (basato su xlrd + yaml) che fa
quello che cerco in maniera automatica.
Basta avere un file xls nella directory ed automaticamente splitta il file
in 2 file csv (avendo 2 fogli).
Lo script si trova qui:

http://code.activestate.com/recipes/546518-simple-conversion-of-excel-files-into-csv-and-yaml/

Lo posto, per qualcuno che si ritrova con il mio stesso problema



___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] TypeError: float argument required, not numpy.void

2012-02-14 Per discussione Daniele Zambelli
Sto lavorando con numpy, ho creato una struttura che contiene alcuni
dati, ma quando tento di salvare l'array usando la funzione np.savetxt
ottengo un errore per me poco comprensibile. Riporto un pezzo di
codice e l'errore:

irt = [('x', float), ('y', float), ('size', float)]
dt = np.dtype([('time', int),
   ('acc', [('x', float), ('y', float), ('z', float)]),
   ('ir', [('ir0', irt), ('ir1', irt),
   ('ir2', irt), ('ir3', irt)]),
  ])
data = [(0, (1, 2, 3), ((10, 20, 30),(10, 20, 30),(10, 20, 30),(10, 20, 30))),
(1, (3, 4, 5), ((30, 40, 50),(30, 40, 50),(30, 40, 50),(30, 40, 50))),
(2, (5, 6, 7), ((50, 60, 70),(50, 60, 70),(50, 60, 70),(50, 60, 70))),
(3, (7, 8, 9), ((70, 80, 90),(70, 80, 90),(70, 80, 90),(70, 80, 90)))]
arraydata = np.array(data, dtype=dt)

np.savetxt('testa.txt', arraydata)

Traceback (most recent call last):
  File .../dtype.py, line 118, in module
np.savetxt('testa.txt', arraydata)
  File /usr/lib/pymodules/python2.7/numpy/lib/npyio.py, line 886, in savetxt
fh.write(asbytes(format % tuple(row) + newline))
TypeError: float argument required, not numpy.void


Qualcuno saprebbe darmi qualche indicazione?


Grazie

-- 

Daniele

www.fugamatematica.blogspot.com

    giusto!
    nel verso
    forse è perché non guardiamo le cose
    Quando non ci capiamo,
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python


[Python] Trigger in python

2012-02-14 Per discussione Diego Barrera

Ho uno script che fa dei calcoli su un DB e aggiorna dei record.
Attualmente lo script viene lanciato a mano, ma avevo intenzione di 
renderlo automatico.

L'ideale sarebbe richiamarlo da un trigger.. qualcuno lo ha gia' fatto?
DBMS mysql 5.1.49  :(

Grazie diego
___
Python mailing list
Python@lists.python.it
http://lists.python.it/mailman/listinfo/python