Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Chris Barker
On Wed, Jan 15, 2014 at 3:58 PM, Julian Taylor < jtaylor.deb...@googlemail.com> wrote: > > fileContent=loadtxt(filePath,dtype='S') > > this gives you bytes not a string, this can only be fixed by adding new > dtypes, or changing the behavior or dtype 'S', but yes, the other thread. But the OP's

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Oscar Benjamin
On 15 January 2014 12:38, Julian Taylor wrote: > On 01/15/2014 11:25 AM, Daπid wrote: >> On 15 January 2014 11:12, Hedieh Ebrahimi > > wrote: >> >> I try to print my fileContent array after I read it and it looks >> like this : >> >> ["b'C:Users

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Julian Taylor
On 16.01.2014 00:42, Chris Barker wrote: > bump back to the OP: > On Wed, Jan 15, 2014 at 2:12 AM, Hedieh Ebrahimi > mailto:hedieh.ebrah...@amphos21.com>> wrote: > > fileContent=loadtxt(filePath,dtype=str) > > > do either of these work for you? > > fileContent=loadtxt(filePath,dtype='S') t

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Chris Barker
bump back to the OP: On Wed, Jan 15, 2014 at 2:12 AM, Hedieh Ebrahimi < hedieh.ebrah...@amphos21.com> wrote: > fileContent=loadtxt(filePath,dtype=str) > do either of these work for you? fileContent=loadtxt(filePath,dtype='S') or fileContent=loadtxt(filePath,dtype=np.unicode) -Chris -- Chr

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array (Charles R Harris)

2014-01-15 Thread David Goldsmith
On Wed, Jan 15, 2014 at 9:52 AM, wrote: > Date: Wed, 15 Jan 2014 10:57:51 -0700 > From: Charles R Harris > Subject: Re: [Numpy-discussion] using loadtxt to load a text file in > to a numpy array > To: Discussion of Numerical Python > Message-ID: > < > cab6mnxjpvjbsozzy0ctk1bk+kd

Re: [Numpy-discussion] adding more unicode dtypes

2014-01-15 Thread Chris Barker
Julian -- beat me to it! On Wed, Jan 15, 2014 at 10:25 AM, Julian Taylor < jtaylor.deb...@googlemail.com> wrote: > On 15.01.2014 18:57, Charles R Harris wrote: > > There was a discussion of this long ago and UCS-4 was chosen as the > > numpy standard. There are just too many complications that ar

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Chris Barker
On Wed, Jan 15, 2014 at 9:57 AM, Charles R Harris wrote: > There was a discussion of this long ago and UCS-4 was chosen as the numpy > standard. There are just too many complications that arise in supporting > both. > fair enough -- but loadtxt appears to be broken just the same. Any proposals

Re: [Numpy-discussion] adding more unicode dtypes

2014-01-15 Thread Julian Taylor
On 15.01.2014 18:57, Charles R Harris wrote: > ... > > There was a discussion of this long ago and UCS-4 was chosen as the > numpy standard. There are just too many complications that arise in > supporting both. > my guess is that that discussion was before python3 and you could still simply tre

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Charles R Harris
On Wed, Jan 15, 2014 at 10:27 AM, Chris Barker wrote: > On Wed, Jan 15, 2014 at 4:38 AM, Julian Taylor < > jtaylor.deb...@googlemail.com> wrote: > >> > I try to print my fileContent array after I read it and it looks >> > like this : >> > >> > ["b'C:UsersDocumentsProject\\

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Chris Barker
On Wed, Jan 15, 2014 at 4:38 AM, Julian Taylor < jtaylor.deb...@googlemail.com> wrote: > > I try to print my fileContent array after I read it and it looks > > like this : > > > > ["b'C:UsersDocumentsProjectmytextfile1.txt'" > > "b'C:UsersDocumentsPro

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Julian Taylor
On 01/15/2014 01:38 PM, Julian Taylor wrote: > On 01/15/2014 11:25 AM, Daπid wrote: >> On 15 January 2014 11:12, Hedieh Ebrahimi for utf 8 data: > > d = np.loadtxt(file, dtype='utf8') > ups this is a very bad example as we can't have utf8 as its variable length, but we can have ascii and uc

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Julian Taylor
On 01/15/2014 11:25 AM, Daπid wrote: > On 15 January 2014 11:12, Hedieh Ebrahimi > wrote: > > I try to print my fileContent array after I read it and it looks > like this : > > ["b'C:UsersDocumentsProjectmytextfile1.txt'" > "b'

Re: [Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Daπid
On 15 January 2014 11:12, Hedieh Ebrahimi wrote: > I try to print my fileContent array after I read it and it looks like this > : > > ["b'C:UsersDocumentsProjectmytextfile1.txt'" > "b'C:UsersDocumentsProjectmytextfile2.txt'" > "b'C:UsersDocumentsProjec

[Numpy-discussion] using loadtxt to load a text file in to a numpy array

2014-01-15 Thread Hedieh Ebrahimi
Hello, I am trying to use the following line of code : fileContent=loadtxt(filePath,dtype=str) in order to load a text file located at path= filePath in to a numpy array called fileContent. I´ve simplifed my file for the purpose of this question but the file looks something like this: file Co