Re: updating NumPy in EPD

2010-06-08 Thread Nick Matzke
ipython import numpy dir(numpy) Thanks! Nick > On Tue, Jun 8, 2010 at 10:30 PM, Nick Matzke > <mailto:mat...@berkeley.edu>> wrote: > > Hi NumPy gurus, > > I have a slightly weird question. I would like to install > the PyCoge

Re: updating NumPy in EPD

2010-06-08 Thread Nick Matzke
ittle library to work. Cheers! Nick Nick Matzke wrote: Hi all, I have a slightly weird question. I would like to install the PyCogent library. However, this requires NumPy 1.3 or higher. I only have NumPy 1.1.1, because I got it as part of the Enthought Python Distribution (4.1) back in

updating NumPy in EPD

2010-06-08 Thread Nick Matzke
Hi all, I have a slightly weird question. I would like to install the PyCogent library. However, this requires NumPy 1.3 or higher. I only have NumPy 1.1.1, because I got it as part of the Enthought Python Distribution (4.1) back in 2008. Now, when I download & install a new version of Nu

Re: cleaning up an ASCII file?

2009-06-10 Thread Nick Matzke
tent2 = unescape(line) ascii_content = unicodedata.normalize('NFKD', unicode(ascii_content2)).encode('ascii','ignore') The string "line" would give the error, but ascii_content does not. Cheers! Nick PS: "asciiDammit" is also fun to look at

Re: cleaning up an ASCII file?

2009-06-10 Thread Nick Matzke
Apologies, I figured there was some easy, obvious solution, since there is in BBedit. I will explain further... John Machin wrote: On Jun 11, 6:09 am, Nick Matzke wrote: Hi all, So I'm parsing an XML file returned from a database. However, the database entries have occasional non-

cleaning up an ASCII file?

2009-06-10 Thread Nick Matzke
Hi all, So I'm parsing an XML file returned from a database. However, the database entries have occasional non-ASCII characters, and this is crashing my parsers. Is there some handy function out there that will schlep through a file like this, and do something like fix the characters that i

debugging in IPython

2009-04-24 Thread Nick Matzke
This is a general question, but maybe there is some obvious solution I've missed. When I am writing code, I have a main script that calls functions in another .py file. When there is a bug or crash in the main script, in IPython I can just start typing the names of variables etc. to see what

Re: pythonic array subsetting

2009-02-17 Thread Nick Matzke
Looks like "compress" is the right numpy function, but it took forever for me to find it... x = array([[1,2,3], [4,5,6], [7,8,9]], dtype=float) compress([1,2], x, axis=1) result: array([[ 1., 2.], [ 4., 5.], [ 7., 8.]]) Gary Herron wrote: Nick Matzke wrote: Hi

pythonic array subsetting

2009-02-16 Thread Nick Matzke
Hi, So I've got a square floating point array that is about 1000 x 1000. I need to subset this array as efficiently as possible based on an ordered sublist of the list of rownames/colnames (they are the same, this is a symmetric array). e.g., if sublist is of length 500, and matches the ro

Re: hist without plotting

2009-02-15 Thread Nick Matzke
Nevermind, I was running the pylab hist; the numpy.histogram function generates the bar counts etc. without plotting the histogram. Cheers! Nick Nick Matzke wrote: Hi, Is there a way to run the numpy hist function or something similar and get the outputs (bins, bar heights) without actually

hist without plotting

2009-02-15 Thread Nick Matzke
Hi, Is there a way to run the numpy hist function or something similar and get the outputs (bins, bar heights) without actually producing the plot on the screen? (R has a plot = false option, something like this is what I'm looking for...) Cheers! Nick --

Re: global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
o it.) Thanks! Nick Diez B. Roggisch wrote: Nick Matzke schrieb: Scott David Daniels wrote: M.-A. Lemburg wrote: On 2009-02-05 10:08, Nick Matzke wrote: ..., I can run this in the ipython shell just fine: a = ["12", "15", "16", "38.2"] dim = int(sqrt(s

Re: global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
Scott David Daniels wrote: M.-A. Lemburg wrote: On 2009-02-05 10:08, Nick Matzke wrote: ..., I can run this in the ipython shell just fine: a = ["12", "15", "16", "38.2"] dim = int(sqrt(size(a))) ...But if I move these commands to a function in anothe

global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
Hi all, So, I can run this in the ipython shell just fine: === a = ["12", "15", "16", "38.2"] dim = int(sqrt(size(a))) dim >2 === But if I move these commands to a function in another file, it freaks out: = a = distances_matrix.split('\t') fro

Re: Comparing two book chapters (text files)

2009-02-04 Thread Nick Matzke
Chris Rebert wrote: On Wed, Feb 4, 2009 at 5:20 PM, Nick Matzke wrote: Hi all, So I have an interesting challenge. I want to compare two book chapters, which I have in plain text format, and find out (a) percentage similarity and (b) what has changed. Some features make this problem

Comparing two book chapters (text files)

2009-02-04 Thread Nick Matzke
Hi all, So I have an interesting challenge. I want to compare two book chapters, which I have in plain text format, and find out (a) percentage similarity and (b) what has changed. Some features make this problem different than what seems to be the standard text-matching problem solvable wi