¡@

Home 

python Programming Glossary: np.loadtxt

major memory problems reading in a csv file using numpy

http://stackoverflow.com/questions/10264739/major-memory-problems-reading-in-a-csv-file-using-numpy

file into memory on my 16GB high memory EC2 instance data np.loadtxt 'rec_log_train.txt' the python session ate up all my memory..

Fit a gaussian function

http://stackoverflow.com/questions/11507028/fit-a-gaussian-function

as plt import numpy as np with open 'gau_b_g_s.csv' as f v np.loadtxt f delimiter ' ' dtype float skiprows 1 usecols None fig ax plt.subplots..

Figure GUI freezing

http://stackoverflow.com/questions/14647491/figure-gui-freezing

time plt.ion plt.figure i 0 while 1 taille 0 fichier np.loadtxt 'data US.SAVE' fichier1 np.loadtxt 'data cond.SAVE' taille1.. 1 taille 0 fichier np.loadtxt 'data US.SAVE' fichier1 np.loadtxt 'data cond.SAVE' taille1 np.size fichier1 1 taille np.size fichier..

Logarithmic y-axis bins in python

http://stackoverflow.com/questions/17952279/logarithmic-y-axis-bins-in-python

import numpy as np import matplotlib.pyplot as plt data np.loadtxt 'foo.bar' fig plt.figure ax fig.add_subplot 111 plt.hist data..

Numpy loading csv TOO slow compared to Matlab

http://stackoverflow.com/questions/18259393/numpy-loading-csv-too-slow-compared-to-matlab

np.genfromtxt '. test.csv' delimiter ' ' stmt2 my_data np.loadtxt '. test.csv' delimiter ' ' t1 timeit.timeit stmt stmt1 setup.. speed but This is much more than I expected Isn't it that np.loadtxt should be faster than np.genfromtxt I haven't tried python csv.. 14.5 s sys 396 ms total 14.9 s Wall time 14.9 s time d np.loadtxt . test.csv delimiter CPU times user 25.7 s sys 28 ms total 25.8..

Peak detection in a 2D array

http://stackoverflow.com/questions/3684484/peak-detection-in-a-2d-array

keep it 'simple'. Here's a version that can be loaded with np.loadtxt Results So I tried @jextee's solution see the results below.. had to reshape. Numpy ignored the shape header. paws_data np.loadtxt paws.txt .reshape 4 11 14 #getting a list of images paws p.squeeze..

How to write a multidimensional array to a text file?

http://stackoverflow.com/questions/3685265/how-to-write-a-multidimensional-array-to-a-text-file

to clarify things # Read the array from disk new_data np.loadtxt 'test.txt' # Note that this returned a 2D array print new_data.shape..

Recreating time series data using FFT results without using ifft

http://stackoverflow.com/questions/4451591/recreating-time-series-data-using-fft-results-without-using-ifft

i np.cos i x Y.imag i np.sin i x return total tempdata np.loadtxt sunspots.dat year tempdata 0 wolfer tempdata 1 Y fft wolfer.. 2 pi N 1j np.sin x ctr 2 pi N return real total tempdata np.loadtxt sunspots.dat year tempdata 0 wolfer tempdata 1 Y fft wolfer..

Make a 2D pixel plot with matplotlib

http://stackoverflow.com/questions/6323737/make-a-2d-pixel-plot-with-matplotlib

as plt import matplotlib.cm as cm x y temp np.loadtxt 'data.txt' .T #Transposed for easier unpacking nrows ncols 100..

Calculating the percentage of variance measure for k-means?

http://stackoverflow.com/questions/6645895/calculating-the-percentage-of-variance-measure-for-k-means

scipy spatial tests data iris.txt' fp open fName X np.loadtxt fp fp.close ##### cluster data into K 1..10 clusters ##### K..

Python out of memory on large CSV file (numpy)

http://stackoverflow.com/questions/8956832/python-out-of-memory-on-large-csv-file-numpy

numpy.fromiter . If you have enough ram consider using np.loadtxt 'yourfile.txt' delimiter ' ' You may also need to specify skiprows..

Simple Digit Recognition OCR in OpenCV-Python

http://stackoverflow.com/questions/9413216/simple-digit-recognition-ocr-in-opencv-python

numpy as np import cv2 fn 'letter recognition.data' a np.loadtxt fn np.float32 delimiter ' ' converters 0 lambda ch ord ch ord.. numpy as np ####### training part ############### samples np.loadtxt 'generalsamples.data' np.float32 responses np.loadtxt 'generalresponses.data'.. np.loadtxt 'generalsamples.data' np.float32 responses np.loadtxt 'generalresponses.data' np.float32 responses responses.reshape..

Intraday candlestick charts using MatPlotLib

http://stackoverflow.com/questions/9673988/intraday-candlestick-charts-using-matplotlib

I'm using the time you formated into an ordinal float data np.loadtxt 'finance data.txt' delimiter ' ' # determine number of days..