We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Cheatsheets / Learn Statistics with NumPy
Introduction to NumPy
Indexing NumPy elements using conditionals
NumPy elements can be indexed using conditionals. The
syntax to filter an array using a conditional is
array_name[conditional]
‘The returned array will contain only the elements for
Which the conditional evaluates to True
NumPy element-wise logical operations
NumPy Arrays support element-wise logical operations,
returning new Arrays populated with False or True
based on their evaluation,
Creating NumPy Arrays from files
NumPy Arrays can be created trom data in CSV files or
‘other delimited text by using the np. genfromtxt()
method.
‘The named parameter delimiter is used to determine
the delimiting character between values.
NumPy Arrays
‘NumPy (short for ‘Numerical Python’ is @ Python module
used for numercel computing, erating arrays ard
matrices, and performing vey fast operations on those
data structures, The core of NumPy is @ mukisimensional
Array object.
The NurPy .array() method is used to create new
NumPy ArraysAccessing NumPy Array elements by index
Individual NumPy Array elements can be accessed by
Index, using syntax identical to Python lst:
array[index] fora single element, or array(start:end]
for alice, where start and end are the starting and 7, 8 9
‘ending indexes for the slice.
Nested Arrays or elements can be accessed by adding
additional comma-separated parameters
# array((4,
NumPy element-wise arithmetic operations
NumPy Arrays support element-wise operations, mesning
that arithmetic operations on arrays are applied to each
value in the array.
Multiple arrays can also be used in arithmetic operations,
provided that they have the same lengths. # array (2,
# array(I5,
cL Print 8 Share v