[Numpy-discussion] loading data with gaps

David Huard david.huard at gmail.com
Fri Apr 4 13:02:45 EDT 2008


Hi Tim,

Look at the thread posted a couple of weeks ago named: loadtxt and missing
values

I'm guessing you'll find answers to your questions, if not, don't hesitate
to ask.

David


2008/4/3, Tim Michelsen <timmichelsen at gmx-topmail.de>:
>
> Hello!
>
> How can I load a data file (e.g. CSV, DAT) in ASCII which has some gaps?
>
> The file has been saved with from a spreadsheet program which leaves
> cells with not data empty:
>
>
> 1,23.
> 2,13.
> 3,
> 4,34.
>
> Would this code be correct:
> ### test_loadtxt.py ###
> import numpy
> import maskedarray
>
> # load data which has empty 'cells' as beeing saved from spreadsheet:
> # 1,23.
> # 2,13.
> # 3,
> # 4,34.
> data = numpy.loadtxt('./loadtxt_test.csv',dtype=str,delimiter=',')
>
>
> # create a masked array with all no data ('', empty cells from CSV) masked
> my_masked_array = maskedarray.masked_equal(data,'')
> ######
>
> * How can I change the data type of my maskedarray (my_masked_array) to
> a type that allows me to perform calulations?
>
> * Would you do this task differently or more efficient?
>
> * What possibilities do I have to estimate/interpolate the masked values?
> A example would be nice.
>
> * How to I convert maskedarray (my_masked_array) to a array without
> masked values?
>
> Thanks in advance for your help,
> Tim Michelsenholg
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20080404/a094fd29/attachment.html>


More information about the NumPy-Discussion mailing list