[sage-support] Re: CSV file I/O

2012-06-22 Thread Jason Grout
On 6/22/12 1:57 PM, John H Palmieri wrote: On Friday, June 22, 2012 11:45:31 AM UTC-7, Dan Aldrich wrote: I think it's a file path problem, that's why I tried the file open dialog. I took a look at my path: '/sagenb/servers/sage_notebook-sagenb.sagenb/home/daldrich/24/data/'

Re: [sage-support] Re: CSV file I/O

2012-06-22 Thread John H Palmieri
On Friday, June 22, 2012 11:45:31 AM UTC-7, Dan Aldrich wrote: > > I think it's a file path problem, that's why I tried the file open > dialog. I took a look at my path: > > '/sagenb/servers/sage_notebook-sagenb.sagenb/home/daldrich/24/data/' > > > But that's on the sagenb server. Is there a wa

Re: [sage-support] Re: CSV file I/O

2012-06-22 Thread Dan Aldrich
I think it's a file path problem, that's why I tried the file open dialog. I took a look at my path: '/sagenb/servers/sage_notebook-sagenb.sagenb/home/daldrich/24/data/' But that's on the sagenb server. Is there a way to upload my csv? That might make things simpler. -d At 01:43 PM 6/22/201

[sage-support] Re: CSV file I/O

2012-06-22 Thread John H Palmieri
On Friday, June 22, 2012 7:53:04 AM UTC-7, Dan Aldrich wrote: > > Trying to read in a .csv file into sagenb. > > data = list(csv.reader(file('C:/Documents and Settings/Dan/My > Documents/Lab6.csv'))) > > Then I thought about using a file dialog instead: > > import csv > import tkFileDialog

Re: [sage-support] Re: CSV file

2012-03-05 Thread Robert Bradshaw
On Sun, Mar 4, 2012 at 10:34 AM, Nils Bruin wrote: > On Mar 4, 1:14 am, Robert Bradshaw > wrote: >> I think it's fair to test for strings first, trying to parse, before >> testing if it's an iterator. This is consistant with many other >> objects that try to "parse" their string representations.

[sage-support] Re: CSV file

2012-03-04 Thread Nils Bruin
On Mar 4, 1:14 am, Robert Bradshaw wrote: > I think it's fair to test for strings first, trying to parse, before > testing if it's an iterator. This is consistant with many other > objects that try to "parse" their string representations. > > sage: ZZ['x']([1,2,3]) > 3*x^2 + 2*x + 1 > sage: ZZ['x'

Re: [sage-support] Re: CSV file

2012-03-04 Thread Robert Bradshaw
On Fri, Mar 2, 2012 at 6:19 PM, Nils Bruin wrote: > On Mar 2, 12:28 am, Robert Bradshaw > wrote: >> The difficulty with accepting an iterator (of strings) is that it is >> unclear if each item corresponds to a row or an element. But I would >> be in favor of rather liberal string parsing, so one

[sage-support] Re: CSV file

2012-03-02 Thread Nils Bruin
On Mar 2, 12:28 am, Robert Bradshaw wrote: > The difficulty with accepting an iterator (of strings) is that it is > unclear if each item corresponds to a row or an element. But I would > be in favor of rather liberal string parsing, so one could do Why is it easier to decide if the items correspo

Re: [sage-support] Re: CSV file

2012-03-02 Thread Robert Bradshaw
The difficulty with accepting an iterator (of strings) is that it is unclear if each item corresponds to a row or an element. But I would be in favor of rather liberal string parsing, so one could do matrix(open("test.csv").read()) just like matrix(""" 1,2,3 4,5,5 """) On Mon, Feb 27, 2012 at 6

[sage-support] Re: CSV file

2012-02-29 Thread Chappman
Thank you very much for that code. Just to clarify, I'm using the sage notebook (running on my machine), will the code still work? I.e. be able to read where the files are on my machine even when using the notebook interface? Thank you very much for your help. Chappman -- To post to this group,

[sage-support] Re: CSV file

2012-02-27 Thread Nils Bruin
On Feb 27, 6:26 am, Jason Grout wrote: > How about the matrix constructor reads from an iterator and recognizes > csv?  We could even use the numpy savetxt and loadtxt functions to more > sophisticated parsing. You can already do: sage: import csv sage: M=matrix(RR,list(csv.reader(open("m.csv"))

[sage-support] Re: CSV file

2012-02-27 Thread Jason Grout
On 2/24/12 1:32 PM, Volker Braun wrote: We do get questions about "how to read matrix from csv" quite regularly. Of course its just a few lines of code, but I think it would be nice to have a matrix_from_file('fname.csv') function that imports csv and perhaps others (gnumeric/ooffice/excel). Any

[sage-support] Re: CSV file

2012-02-26 Thread Dima Pasechnik
In gmane.comp.mathematics.sage.support, you wrote: > Hi Harald, > > You answered I should of phrased that question better, but lets say I > created a matrix in Sage, and I want to save it as a csv file how do I > do that? > > The matrix is made from the following function below > > Def function(A,D

[sage-support] Re: CSV file

2012-02-26 Thread Chappman
Hi Harald, You answered I should of phrased that question better, but lets say I created a matrix in Sage, and I want to save it as a csv file how do I do that? The matrix is made from the following function below Def function(A,D) (syntex for making matrix P) return P Kind Regards Chappma

[sage-support] Re: CSV file

2012-02-24 Thread Volker Braun
We do get questions about "how to read matrix from csv" quite regularly. Of course its just a few lines of code, but I think it would be nice to have a matrix_from_file('fname.csv') function that imports csv and perhaps others (gnumeric/ooffice/excel). Any volunteers? ;-) On Friday, Februar

[sage-support] Re: CSV file

2012-02-24 Thread Harald Schilly
On Friday, February 24, 2012 11:13:53 AM UTC+1, Chappman wrote: > > and then using a function which opens up the CSV file and utilizes the > entires in the matrix P, from the CSV file. > Is there a method for this? uhm, i'm not sure if you ask about reading or writing. also, your "d" in def