[SciPy-user] reading data with gaps and converting

Tim Michelsen timmichelsen at gmx-topmail.de
Tue Nov 20 17:58:07 EST 2007


Hello,
I encountered another difficulty converting my files from one
format to the other.

Below you may find a simplified example.

When I try to load for instance row 1 on the input file the pylab.load
or scipy.io.read_array complains that the index is out of range or
that a sequence cannot be converted into a array.
I assume that the problem are the cells without any data.
The file I use was exported from Excel.
There may be some of you who have had to deal with similar format
conversion issues. Therefore I would be very happy someone could indicate
me a method how to read such structured data efficiently into a array.

Thanks in advance.

Kind regards,
Tim 


reduced example data:

input file structure

     parameter1    parameter1    parameter2    parameter2    
year       month      day    hour1     hour2     hour1     hour2     
2007     11     20       8         2
2007     11     21         9         3         4         4
2007     11     22         2         8         4         8
2007     11     23         3         3         6        51
2007     11     24       1        72        34
2007     11     25         7         9        34        24
2007     11     26         6        65        12         1
2007     11     27         7         0        19         2
2007     11     28      44        21         2
       
                                                                           
                                                                           
output file structure                   
                                                      
                                                                           
       
year       month      day    hour      parameter1    parameter2    
       2007     11     20         1         nodata    2
       2007     11     20         2         8        nodata    
       2007     11     21         1         9         4
       2007     11     21         2         3         4
       2007     11     22         1         2         4
       2007     11     22         2         8         8




More information about the SciPy-User mailing list