Numpy: Difference between revisions
From charlesreid1
No edit summary |
No edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 5: | Line 5: | ||
Sometimes you want to initalize an empty array, which is a really inefficient use of memory for large matrices but you could care less if it's a dozen items. | Sometimes you want to initalize an empty array, which is a really inefficient use of memory for large matrices but you could care less if it's a dozen items. | ||
< | <pre> | ||
# You can initialize an array with []: | # You can initialize an array with []: | ||
| Line 32: | Line 32: | ||
In [74]: x | In [74]: x | ||
Out[74]: array([ 1., 2., 3.]) | Out[74]: array([ 1., 2., 3.]) | ||
</ | </pre> | ||
{{LinearAlgebraFlag}} | |||
{{ScientificComputingFlag}} | |||
{{PythonFlag}} | |||
Latest revision as of 09:19, 16 April 2017
Arrays
Initializing an empty array
Sometimes you want to initalize an empty array, which is a really inefficient use of memory for large matrices but you could care less if it's a dozen items.
# You can initialize an array with []: In [62]: x=[] In [63]: x=np.array(x) In [64]: x Out[64]: array([], dtype=float64) # to be more direct about it, In [66]: x = np.array([],dtype=np.float64) In [67]: x Out[67]: array([], dtype=float64) # Now you can append to the empty array In [71]: x = append(x,1) In [72]: x = append(x,2) In [73]: x=append(x,3) In [74]: x Out[74]: array([ 1., 2., 3.])
| Linear Algebra Topics in linear algebra.
Matlab · Octave · Sundials · Trilinos
|
| Scientific Computing Topics in scientific computing.
Numerical Software: Lapack · Sundials · Matlab · Octave · FFTW Petsc · Example Petsc Makefile · Trilinos · Hypre · Ginac · Gnuplot
Python: Numpy · Scipy · Pandas · Matplotlib · Python Sundials · Py4Sci Scikit-learn: Sklearn · Skimage
|
| Python a powerful programming language
Scientific Python: Data analysis libraries: Scipy · Numpy · Pandas · Statsmodel Machine learning libraries: Sklearn Neural network libraries: Tensorflow · Keras Plotting/viz: Matplotlib · Seaborn · Jupyter Solving partial differential equations and bessel functions: Fipy · Bessel Functions
Web and Networking Python: Web programming: Flask · Webapps · Mechanize · Scrapy · Gunicorn Wifi: Wireless/Python · Scapy IPython and Jupyter: Jupyter
Drawing, Geometry, and Shapes: Shapely (for drawing shapes): Shapely Geography library: Geos
General Useful Python Utilities: Python Remote Objects: Pyro Logging (create multi-channel log messages): Logging Keyboard (control keyboard from Python): Keyboard
Black Hat Python: Network scanning: Python/Scanner
|