Strange output from arange()

2011-07-25 Thread Christopher Barrington-Leigh
The following code: from pylab import arange nSegments=5.0 print arange(0,1.0+1.0/nSegments,1.0/nSegments) nSegments=6.0 print arange(0,1.0+1.0/nSegments,1.0/nSegments) nSegments=8.0 print arange(0,1.0+1.0/nSegments,1.0/nSegments) nSegments=10.0 print

Re: Automatic placement of a text box? ie empty legend [matplotlib]

2011-06-29 Thread Christopher Barrington-Leigh
I still need help with this. I'd like to have the Sample A box place itself in the optimal empty space, so as not to overly any graphing elements (if possible): import numpy.random import matplotlib.pyplot as plt fig = plt.figure(1, figsize=(5,5)) fig.clf() ax = fig.add_subplot(111)

scipy / stats : quantiles using sample weights from survey data

2010-08-04 Thread Christopher Barrington-Leigh
There is a function scipy.stats.mstats.mquantiles that returns quantiles for a vector of data. But my data should not be uniformly weighted in an estimate of the distribution, since they are from a survey and come with estimated sampling weights based on the stratification used in sampling. Is

CSV module: incorrectly parsed file.

2008-02-17 Thread Christopher Barrington-Leigh
Here is a file test.csv number,name,description,value 1,wer,tape 2,5 1,vvv,hoohaa,2 I want to convert it to tab-separated without those silly quotes. Note in the second line that a field is 'tape 2' , ie two inches: there is a double quote in the string. When I use csv module to read this: