¡@

Home 

python Programming Glossary: np.random.randn

Python Pandas: how to turn a DataFrame with “factors” into a design matrix for linear regression?

http://stackoverflow.com/questions/10196860/python-pandas-how-to-turn-a-dataframe-with-factors-into-a-design-matrix-for-l

'two' 'one' 'six' 'b' 'x' 'y' 'y' 'x' 'y' 'x' 'x' 'c' np.random.randn 7 df2 a b c 0 one x 0.000343 1 one y 0.055651 2 two y 0.249194..

Pandas timeseries plot setting x-axis major and minor ticks and labels

http://stackoverflow.com/questions/12945971/pandas-timeseries-plot-setting-x-axis-major-and-minor-ticks-and-labels

May to 1 July 2011 dateIndex testSeries pandas.Series data np.random.randn len dateIndex index dateIndex ax plt.figure figsize 7 4 dpi.. idx pd.date_range '2011 05 01' '2011 07 01' s pd.Series np.random.randn len idx index idx fig ax plt.subplots ax.plot_date idx.to_pydatetime..

Benefits of panda's multiindex?

http://stackoverflow.com/questions/13226029/benefits-of-pandas-multiindex

'one' 'one' 'two' 'two' 'two' 1 2 3 1 2 3 df pd.DataFrame np.random.randn 6 2 index pd.MultiIndex.from_tuples zip np.arrays columns 'A'..

What determines whether different Python processes are assigned to the same or different cores?

http://stackoverflow.com/questions/15639779/what-determines-whether-different-python-processes-are-assigned-to-the-same-or-d

in data 0 for jj in data 1 ii jj def run niter 10 data np.random.randn 2 100 for ii in xrange niter pool Parallel n_jobs 1 verbose..

Grabbing selection between specific dates in a DataFrame

http://stackoverflow.com/questions/16341367/grabbing-selection-between-specific-dates-in-a-dataframe

You could define a mask separately df DataFrame 'a' np.random.randn 100 'b' np.random.randn 100 mask df.b .5 df.b .5 df_masked df.. a mask separately df DataFrame 'a' np.random.randn 100 'b' np.random.randn 100 mask df.b .5 df.b .5 df_masked df mask Or in one line df_masked..

Generate a heatmap in MatPlotLib using a scatter data set

http://stackoverflow.com/questions/2369492/generate-a-heatmap-in-matplotlib-using-a-scatter-data-set

matplotlib.pyplot as plt # Generate some test data x np.random.randn 8873 y np.random.randn 8873 heatmap xedges yedges np.histogram2d.. as plt # Generate some test data x np.random.randn 8873 y np.random.randn 8873 heatmap xedges yedges np.histogram2d x y bins 50 extent..

HOW TO: Draggable legend in matplotlib

http://stackoverflow.com/questions/2539477/how-to-draggable-legend-in-matplotlib

self ax self.figure.add_subplot 111 scatter ax.scatter np.random.randn 100 np.random.randn 100 legend DraggableLegend ax.legend I emailed.. 111 scatter ax.scatter np.random.randn 100 np.random.randn 100 legend DraggableLegend ax.legend I emailed the Matplotlib..

Resampling irregularly spaced data to a regular grid in Python

http://stackoverflow.com/questions/3864899/resampling-irregularly-spaced-data-to-a-regular-grid-in-python

x np.zeros 512 115 # Just random data for this test data np.random.randn 512 115 # filling the grid coordinates for i in range 512 y..

Matplotlib: simultaneous plotting in multiple threads

http://stackoverflow.com/questions/4659680/matplotlib-simultaneous-plotting-in-multiple-threads

plot input def plot args num i args fig plt.figure data np.random.randn num .cumsum plt.plot data plt.title 'Plot of a i element brownian..

Histogram Matplotlib

http://stackoverflow.com/questions/5328556/histogram-matplotlib

as plt import numpy as np mu sigma 100 15 x mu sigma np.random.randn 10000 hist bins np.histogram x bins 50 width 0.7 bins 1 bins..

Matplotlib - label each bin

http://stackoverflow.com/questions/6352740/matplotlib-label-each-bin

np from matplotlib.ticker import FormatStrFormatter data np.random.randn 82 fig ax plt.subplots counts bins patches ax.hist data facecolor..

Convolution computations in Numpy/Scipy

http://stackoverflow.com/questions/6855169/convolution-computations-in-numpy-scipy

idx mode 'same' return outputs def test num chans sig1 np.random.randn chans num sig2 np.random.randn chans num res1 mix1 sig1 sig2.. def test num chans sig1 np.random.randn chans num sig2 np.random.randn chans num res1 mix1 sig1 sig2 res2 mix2 sig1 sig2 np.testing.assert_almost_equal..

How can I release memory after creating matplotlib figures

http://stackoverflow.com/questions/7101404/how-can-i-release-memory-after-creating-matplotlib-figures

savefig import numpy as np import gc a np.arange 1000000 b np.random.randn 1000000 fig plt.figure num 1 dpi 100 facecolor 'w' edgecolor..

Matplotlib errors result in a memory leak. How can I free up that memory?

http://stackoverflow.com/questions/7125710/matplotlib-errors-result-in-a-memory-leak-how-can-i-free-up-that-memory

as plt import numpy as np import gc a np.arange 1000000 b np.random.randn 1000000 fig plt.figure num 1 dpi 100 facecolor 'w' edgecolor.. multiprocessing as mp def worker N 1000000 a np.arange N b np.random.randn N fig plt.figure num 1 dpi 100 facecolor 'w' edgecolor 'w' fig.set_size_inches..