<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: data.frames in Python - DataMatrix</title>
	<atom:link href="http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix</link>
	<description>On the web since 1999</description>
	<pubDate>Wed, 07 Jan 2009 18:49:48 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.5</generator>
		<item>
		<title>By: Einar</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10651</link>
		<dc:creator>Einar</dc:creator>
		<pubDate>Fri, 07 Nov 2008 22:09:33 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10651</guid>
		<description>The last line should be
datamatrix[col_names[int(num)-1] = col_data 

and to save, the writeMatrix function is not part of the class, so assuming you have imported "datamatrix":

datamatrix.writeMatrix(datamatrix_object,open("somefile.txt","w",header=true)

Notice that this will work only with the git version of DataMatrix (since it has changed a bit internally)

With the old version, I think you should do

datamatrix.writeMatrix(datamatrix_object,"somefile.txt")

Where datamatrix_object is your DataMatrix instance.</description>
		<content:encoded><![CDATA[<p>The last line should be<br />
datamatrix[col_names[int(num)-1] = col_data </p>
<p>and to save, the writeMatrix function is not part of the class, so assuming you have imported &#8220;datamatrix&#8221;:</p>
<p>datamatrix.writeMatrix(datamatrix_object,open(&#8221;somefile.txt&#8221;,&#8221;w&#8221;,header=true)</p>
<p>Notice that this will work only with the git version of DataMatrix (since it has changed a bit internally)</p>
<p>With the old version, I think you should do</p>
<p>datamatrix.writeMatrix(datamatrix_object,&#8221;somefile.txt&#8221;)</p>
<p>Where datamatrix_object is your DataMatrix instance.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10650</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 07 Nov 2008 21:49:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10650</guid>
		<description>Hi Einar,

Thanks for the reply. I am new in python so I am not so sure how you said works.

Here is part of the code I wrote:
===========================
for num in column:
(indent) col_data=data_obj.getColumn(col_names[int(num)-1])
(indent)(indent) for i in range(1,len(col_data)):
(indent)(indent)(indent) col_data[i]=col_data[i].replace(old,new)
(indent)(indent) datamatrix(col_names[int(num)-1])=col_data
===========================
NOTE:
(indent)-&#62; represents indentation since the blog does not support it
column-&#62; a list of column which I would like to apply the substitution
col_names-&#62; a list of column names
data_obj-&#62; datamatrix object
old-&#62; some pattern I do not want to keep
new-&#62; substitute old by the new pattern

The last line of the code, which I mimic what you said about reassign it with datamatrix[columnname] = list, does not work since it assigns to function call.

I think my question is related to how to make changes within column entries and then save and write the datamatrix object into a file.

I really appreciate any comments and suggestions you gave.

Mike</description>
		<content:encoded><![CDATA[<p>Hi Einar,</p>
<p>Thanks for the reply. I am new in python so I am not so sure how you said works.</p>
<p>Here is part of the code I wrote:<br />
===========================<br />
for num in column:<br />
(indent) col_data=data_obj.getColumn(col_names[int(num)-1])<br />
(indent)(indent) for i in range(1,len(col_data)):<br />
(indent)(indent)(indent) col_data[i]=col_data[i].replace(old,new)<br />
(indent)(indent) datamatrix(col_names[int(num)-1])=col_data<br />
===========================<br />
NOTE:<br />
(indent)-&gt; represents indentation since the blog does not support it<br />
column-&gt; a list of column which I would like to apply the substitution<br />
col_names-&gt; a list of column names<br />
data_obj-&gt; datamatrix object<br />
old-&gt; some pattern I do not want to keep<br />
new-&gt; substitute old by the new pattern</p>
<p>The last line of the code, which I mimic what you said about reassign it with datamatrix[columnname] = list, does not work since it assigns to function call.</p>
<p>I think my question is related to how to make changes within column entries and then save and write the datamatrix object into a file.</p>
<p>I really appreciate any comments and suggestions you gave.</p>
<p>Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Einar</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10649</link>
		<dc:creator>Einar</dc:creator>
		<pubDate>Fri, 07 Nov 2008 19:58:25 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10649</guid>
		<description>DataMatrix entries are lists, hence mutable. The latest version (in git) supports __setitem__ so you could make a list of tuples in the same format as the entries you read (e.g. a list of (rowname, value) tuples) and reassign it with datamatrix[columnname] = list .
Then you can use the writeMatrix function (use the one in the git repository, the one in the 0.5 version is broken as far as I remember) to write the modified DataMatrix to a file.
I have made loads of enhancements with respect to this version, so I guess I should put a new version out soon.</description>
		<content:encoded><![CDATA[<p>DataMatrix entries are lists, hence mutable. The latest version (in git) supports __setitem__ so you could make a list of tuples in the same format as the entries you read (e.g. a list of (rowname, value) tuples) and reassign it with datamatrix[columnname] = list .<br />
Then you can use the writeMatrix function (use the one in the git repository, the one in the 0.5 version is broken as far as I remember) to write the modified DataMatrix to a file.<br />
I have made loads of enhancements with respect to this version, so I guess I should put a new version out soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10648</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 07 Nov 2008 19:19:23 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10648</guid>
		<description>Hi,

I found your module quite useful! really like it.
However, one thing I dont get is how I am able to modify some entries in a few columns and then write the whole matrix back to a file with the modification I made. Say, I have a file with 10 columns and each column has a few thousand entries. If I would like to rename entries, whose value &#60;10, as "NA" for only some columns, I do not see a way to write the modification into a file. Can you give me some examples in this purpose?

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I found your module quite useful! really like it.<br />
However, one thing I dont get is how I am able to modify some entries in a few columns and then write the whole matrix back to a file with the modification I made. Say, I have a file with 10 columns and each column has a few thousand entries. If I would like to rename entries, whose value &lt;10, as &#8220;NA&#8221; for only some columns, I do not see a way to write the modification into a file. Can you give me some examples in this purpose?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10647</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 07 Nov 2008 19:19:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10647</guid>
		<description>Hi,

I found your module quite usefule! really like it.
However, one thing I dont get is how I am able to modify some entries in a few columns and then write the whole matrix back to a file with the modification I made. Say, I have a file with 10 columns and each column has a few thousand entries. If I would like to rename entries, whose value &#60;10, as "NA" for only some columns, I do not see a way to write the modification into a file. Can you give me some examples in this purpose?

Thanks!</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>I found your module quite usefule! really like it.<br />
However, one thing I dont get is how I am able to modify some entries in a few columns and then write the whole matrix back to a file with the modification I made. Say, I have a file with 10 columns and each column has a few thousand entries. If I would like to rename entries, whose value &lt;10, as &#8220;NA&#8221; for only some columns, I do not see a way to write the modification into a file. Can you give me some examples in this purpose?</p>
<p>Thanks!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Einar</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10577</link>
		<dc:creator>Einar</dc:creator>
		<pubDate>Sun, 29 Jun 2008 15:32:47 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10577</guid>
		<description>Good catch. I found the scipy web page a little disorganized, that is why I probably did not find it. I will see if I can integrate the file management part (AFAIK numpy provides only simplistic ways of converting files into arrays) with either recarrays or Record Arrays.
Thanks a lot for the suggestion!
EDIT: I have briefly looked at numpy and looks like you can't really add arrays in an iteration like my module does. The only alternative would be to use fromfile to load the file directly and add the record array on the spot, but I'm not sure if I should use that since numpy's documentation says that the function is not very robust.</description>
		<content:encoded><![CDATA[<p>Good catch. I found the scipy web page a little disorganized, that is why I probably did not find it. I will see if I can integrate the file management part (AFAIK numpy provides only simplistic ways of converting files into arrays) with either recarrays or Record Arrays.<br />
Thanks a lot for the suggestion!<br />
EDIT: I have briefly looked at numpy and looks like you can&#8217;t really add arrays in an iteration like my module does. The only alternative would be to use fromfile to load the file directly and add the record array on the spot, but I&#8217;m not sure if I should use that since numpy&#8217;s documentation says that the function is not very robust.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony</title>
		<link>http://www.dennogumi.org/2008/06/dataframes-in-python-datamatrix#comment-10576</link>
		<dc:creator>Tony</dc:creator>
		<pubDate>Sun, 29 Jun 2008 15:22:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.dennogumi.org/?p=405#comment-10576</guid>
		<description>Nice work. 

Have you played around with numpy? This is pretty similar to Record Arrays [http://www.scipy.org/RecordArrays]  and recarrays (which, is similar to Record Arrays, but slightly different) in numpy.</description>
		<content:encoded><![CDATA[<p>Nice work. </p>
<p>Have you played around with numpy? This is pretty similar to Record Arrays [http://www.scipy.org/RecordArrays]  and recarrays (which, is similar to Record Arrays, but slightly different) in numpy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
