Blog Archives

Sci-fi Survey Preliminary Results

I have preliminary results from the science fiction readership survey. Cheers to everyone who participated!

You should be able to see Google Form’s summary by going to

For my fellow quant nerds, I started a repository with the raw data and my preliminary statistical analysis

Over the next couple weeks I will be figuring out what it all means and writing a report, which I will also post. I did notice a couple of things right away, though:

1) More than half the respondents self identify as librarians. Apparently, librarians like to take surveys about libraries…

2) Series related factors are the most important to the majority of readers. People want to continue reading series they have started or start new series with lots of books available at the library.

3) The respondents cluster rather neatly into two groups, which we can call “Heavy Readers” and “Moderate Readers”. The heavy readers seem to skew female and be more educated–though probably not as much as it seems from the raw data, since we have so many librarians responding (librarians also skew female, and most of them have masters degrees). This seems to agree with the academic literature, such as this article which I found after the survey had already started.

More to come. Thanks again!

Python Histograms from the Console

Lately, while working on my MBA thesis, there have been many times when I’ve been working in Python and wanted to plot a quick histogram of a distribution. The whole process has been far too time consuming. Either I need to remember how to write my list out as a CSV file so I can plot it in Excel/Tableau/SPSS (none of which, IMHO, has a particularly intuitive mechanism for drawing histograms) or I need to be able plot the histogram directly from Python. The later would be fine, except that I’m usually in an SSH shell and I always have trouble with X servers on my Windows 8 laptop.

So, anyway, I wrote this little function and it works quite nice for plotting histograms in pure text mode. It should be fine with any terminal client of the last 50 years. It isn’t particularly sophisticated, but it works for me and may work for you too.

def crappyhist(a, bins):
    '''Draws a crappy text-mode histogram of an array'''
    import numpy as np
    import string
    from math import log10

    h,b = np.histogram(a, bins)

    for i in range (0, bins-1):
	    print string.rjust(`b[i]`, 7)[:int(log10(
                   np.amax(b)))+5], '| ', '#'*int(70*h[i-1]/np.amax(h))
    print string.rjust(`b[bins]`, 7)[:int(log10(np.amax(b)))+5] 

Screen shot of the crappyhist() function in action.