Re: [Numpy-discussion] loading data with gaps

2008-04-04 Thread David Huard
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 [EMAIL PROTECTED]:

 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@scipy.org
 http://projects.scipy.org/mailman/listinfo/numpy-discussion

___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] loading data with gaps

2008-04-03 Thread Tim Michelsen
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@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion