search
Search
Login
Unlock 100+ guides
menu
menu
web
search toc
close
Comments
Log in or sign up
Cancel
Post
account_circle
Profile
exit_to_app
Sign out
What does this mean?
Why is this true?
Give me some examples!
search
keyboard_voice
close
Searching Tips
Search for a recipe:
"Creating a table in MySQL"
Search for an API documentation: "@append"
Search for code: "!dataframe"
Apply a tag filter: "#python"
Useful Shortcuts
/ to open search panel
Esc to close search panel
to navigate between search results
d to clear all current filters
Enter to expand content preview
icon_star
Doc Search
icon_star
Code Search Beta
SORRY NOTHING FOUND!
mic
Start speaking...
Voice search is only supported in Safari and Chrome.
Navigate to
chevron_leftNumPy
Documentation240 topics
Cookbooks42 topics
Getting startedAPI referenceRecipes reference
check_circle
Mark as learned
thumb_up
1
thumb_down
0
chat_bubble_outline
0
Comment
auto_stories Bi-column layout
settings

NumPy | API reference

schedule Aug 10, 2023
Last updated
local_offer
PythonNumPy
Tags
tocTable of Contents
expand_more
mode_heat
Master the mathematics behind data science with 100+ top-tier guides
Start your free 7-days trial now!
  • NumPy | abs method
    Numpy's np.abs(~) method returns a Numpy array with the absolute value applied to each of its values.
  • NumPy | absolute method
    Numpy's np.absolute(~) method returns a Numpy array with the absolute value applied to each of its value.
  • NumPy | add method
    Numpy's add(~) method takes in two array and performs an element-wise addition.
  • NumPy | all method
    Numpy's all(~) method returns True if all elements in the input array evaluate to True. Note that missing values (np.NaN) would evaluate to True.
  • NumPy | allclose method
    Numpy's allclose(~) performs an element-wise comparison given two arrays, and returns True if all of the differences between each pair falls within the specified tolerance.
  • NumPy | amax method
    Numpy's amax(~) method returns the largest value in the Numpy array. The maximums can also be computed row-wise and column-wise.
  • NumPy | amin method
    Numpy's amin(~) method returns the smallest value in the Numpy array. The minimums can also be computed row-wise and column-wise.
  • NumPy | any method
    Numpy's any(~) method returns True if at least one element in the input array evaluate to True. Note that missing values (np.NaN) would evaluate to True.
  • NumPy | append method
    Numpy's append(~) method returns a new Numpy array with the specified values appended to the input array.
  • NumPy | arange method
    Numpy's arange(~) method is used to create a Numpy array with equally spaced values, similar to Python's range(~) method.
  • NumPy | arccos method
    Numpy's arccos(~) method computes the inverse cosine of each of the input values in radians.
  • NumPy | arcsin method
    Numpy's arcsin(~) method computes the inverse sine of each of the input values in radians.
  • NumPy | arctan method
    Numpy's arctan(~) method computes the inverse tangent of each of the input values in radians.
  • NumPy | argmax method
    Numpy's argmax(~) method returns the index that corresponds to the largest element in the array.
  • NumPy | argmin method
    Numpy's argmin(~) method returns the index that corresponds to the smallest element in the array.
  • NumPy | argpartition method
    Numpy's argparition(~) method is used to partition an array based on ascending order.
  • NumPy | argsort method
    Numpy's argsort(~) method returns the integer indices of the sorted copy of the input array.
  • NumPy | argwhere method
    Numpy's argwhere(~) method returns the indices of non-zero values.
  • NumPy | around method
    Numpy's around(~) method rounds up and down the values in the input array.
  • NumPy | array method
    Numpy's array(~) method constructs a Numpy array out of the provided object, which is typically a list or a tuple.
  • NumPy | array2string method
    Numpy's array2string(~) method returns a string representation of your Numpy array formatted as specified.
  • NumPy | array_equal method
    Numpy's array_equal(~) takes in two arrays and returns True if they have the same shape and elements.
  • NumPy | array_equiv method
    Numpy's array_equiv(~) takes in two arrays and returns True if they have consistent shape and the same elements.
  • NumPy | array_split method
    Numpy's array_split(~) method divides up the input array as per the specified parameters.
  • NumPy | asarray method
    Numpy's asarray(~) method constructs a Numpy array out of the provided object, which is typically a list or a tuple.
  • NumPy | asfarray method
    Numpy's asfarray(~) converts an array to float type.
  • NumPy | asmatrix method
    Numpy's asmatrix(~) method constructs a matrix from a sequence of data (e.g. arrays and tuples).
  • NumPy | asscalar method
    Numpy's asscalar(~) method converts an array of size one to a scalar.
  • NumPy | average method
    Numpy's average(~) method computes the weighted average along the specified axis.
  • NumPy | bincount method
    Numpy's bincount(~) method computes the bin count (i.e. the number of values that fall in an interval) given an array of values. By default, the interval size of each bin is one, and so the number of bins is dependent on the range of the input values.
  • NumPy | busday_count method
    Numpy's busday_count(~) method counts the number of valid dates given a range of datetimes. Note that busday stands for business day, but we can specify what a "business" day is via the parameters.
  • NumPy | busday_offset method
    Numpy's busday_offset(~) method shifts the provided datetimes by a specific offset in valid days. Note that busday stands for business day, but we can specify what a "business" day is via the parameters.
  • NumPy | cbrt method
    Numpy's cbrt(~) method computes the cube-root of of each value in the input array.
  • NumPy | ceil method
    Numpy's ceil(~) method returns the ceiling for each value in the input array. See examples below for clarification.
  • NumPy | choice method
    NumPy's choice() method returns an array of random samples.
  • NumPy | choose method
    Numpy's choose(~) method constructs a new array from a subset of the input array.
  • NumPy | clip method
    Numpy's clip(~) method is used to ensure that the values of the input array are between a particular range.
  • NumPy | compress method
    Numpy's compress(~) method extracts a subset of the input values based on the given condition.
  • NumPy | corrcoef method
    Numpy's corrcoef(~) method computes the Pearson's correlation coefficient given two arrays.
  • NumPy | cos method
    Numpy's cos(~) method computes the cosine of each of the input values in radians.
  • NumPy | count_nonzero method
    Numpy's count_nonzero(~) method counts the number of non-zeros in an array along a given axis.
  • NumPy | cov method
    Numpy's cov(~) method computes the covariance given two arrays.
  • NumPy | cross method
    Numpy's cross(~) method computes the cross product of two input arrays.
  • NumPy | cumprod method
    Numpy's cumprod(~) method returns an array holding the cumulative products of the input array.
  • NumPy | cumsum method
    Numpy's cumsum(~) method returns an array holding the cumulative sums of the input array.
  • NumPy | datetime_as_string method
    Numpy's datetime_as_string(~) method converts an array of datetimes into an array of strings, and offers a myriad of ways for formatting.
  • NumPy | datetime_data method
    Numpy's datetime_data(~) method extracts information about the unit as well as the step-size.
  • NumPy | deg2rad method
    Numpy's deg2rad(~) converts degrees to radians.
  • NumPy | degrees method
    Numpy's degrees(~) method converts radians to degrees.
  • NumPy | delete method
    Numpy's delete(~) method returns a new Numpy array with the specified values deleted.
  • NumPy | diag method
    Numpy's diag(~) method returns the diagonal of the input array.
  • NumPy | diagflat method
    Numpy's diagflat(~) method creates a 2D Numpy array with the diagonals specified by a flattened input array. All other entries are filled with zero.
  • NumPy | diagonal method
    Numpy's diagonal(~) method returns the diagonal of the input array.
  • NumPy | diff method
    Numpy's diff(~) method computes the difference between each value and its adjacent value in the input array.
  • NumPy | digitize method
    Numpy's digitize(~) method returns a Numpy array of indices of the bins to which the values in the input array belongs to. To explain in plain words is difficult, so please look at the examples for clarification.
  • NumPy | divide method
    Numpy's divide(~) method performs element-wise true division given two arrays. True division means that 5/2=2.5 as opposed to floor division, which is 5//2=2. The methods divide(~) and true_divide(~) are the equivalent.
  • NumPy | divmod method
    Numpy's divmod(~) method returns the tuple (x//y, x%y) for each dividend x and divisor y in the input arrays. Here, // denotes integer division, while % denotes the standard Python modulo.
  • NumPy | dot Method
    NumPy's dot(~) is an extremely useful method that can be used to compute the product between: scalar and scalar, vector and vector (dot product), matrix and vector, matrix and matrix.
  • NumPy | dstack method
    Numpy's dstack(~) method is used to concatenate arrays along the third axis.
  • NumPy | ediff1d method
    Numpy's ediff1d(~) method computes the difference between each value and its adjacent value in the input array.
  • NumPy | empty method
    Numpy's empty(~) method creates a new array with the arbitrary entries. This differs from Numpy's zeros(~) method in that the zero(~) method initializes the entries with 0, whereas nothing is initialized for the empty(~).
  • NumPy | equal method
    Numpy's equal(~) method performs an element-wise equal-to (==) comparison given two arrays.
  • NumPy | exp method
    Numpy's exp(~) method computes the exponential of the values in the input array, that is, e**p where p is each value in the input array.
  • NumPy | exp2 method
    Numpy's exp2(~) method returns 2**p (2 raised to the power of p), where p is each number in the input array.
  • NumPy | expand_dims method
    Numpy's expand_dims(~) method returns a new Numpy array with dimensions of the input array expanded.
  • NumPy | expm1 method
    Numpy's expm1(~) method computes exp(p)-1 for each value p in the input array.
  • NumPy | extract
    Numpy's extract(~) method extracts values from the input array that pass the provided criteria.
  • NumPy | eye method
    Numpy's eye(~) method returns a 2D array with its diagonals filled with 1s, and all other entries filled with 0s.
  • NumPy | fabs method
    Numpy's np.fabs(~) method returns a Numpy array with the absolute value applied to each of its value.
  • NumPy | fill_diagonal method
    Numpy's fill_diagonal(~) method sets a specified value for the diagonals of the Numpy array. Note that this happens in-place, that is, no new array is created.
  • NumPy | finfo method
    NumPy's finfo(~) method returns information about a particular NumPy float data type. Information includes the number of bits occupied by that data type, and the maximum and minimum limits of supported values.
  • NumPy | fix method
    Numpy's fix(~) method returns the ceiling for negative values and the floor for positive values. See examples below for clarification.
  • NumPy | flatnonzero method
    Numpy's flatnonzero(~) method returns the indices of non-zero values in the flattened version of the input array.
  • NumPy | flatten method
    Numpy's flatten(~) method returns a new flattened version of the input array. If you want to avoid a creation of a new array, then use the ravel(~) method instead.
  • NumPy | flip Method
    Numpy's flip(~) method reverses the ordering of the elements along the given axis. Note that this method does not flip bits (i.e. turns 0s into 1s, and 1s into 0s).
  • NumPy | fliplr method
    Numpy's fliplr(~) method reverses the ordering of the elements column-wise (horizontal flip). Note that this method does not flip bits (i.e. turns 0s into 1s, and 1s into 0s).
  • NumPy | flipud method
    Numpy's flipud(~) method reverses the ordering of the elements row-wise (vertical flip). Note that this method does not flip bits (i.e. turns 0s into 1s, and 1s into 0s).
  • NumPy | float_power method
    Numpy's float_power(~) method raises each value in the input array by the specified amount.
  • NumPy | floor method
    Numpy's floor(~) method returns the floor for each value in the input array. See examples below for clarification.
  • NumPy | floor_divide method
    Numpy's floor_divide(~) method performs element-wise floor division given two arrays. Floor division means that 5//2=2 as opposed to true division, which is 5/2=2.5.
  • NumPy | fmod method
    Numpy's fmod(~) method computes the remainder element-wise given two arrays.
  • NumPy | frombuffer method
    Numpy's frombuffer(~) method constructs a Numpy array from a buffer.
  • NumPy | fromfunction method
    Numpy's fromfunction(~) method constructs a Numpy array using a function that initializes the value for each cell.
  • NumPy | fromiter method
    Numpy's fromiter(~) method constructs a Numpy array from an iterable object (e.g. lists and strings).
  • NumPy | fromstring method
    Numpy's fromstring(~) method constructs a Numpy array from the specified string.
  • NumPy | full method
    Numpy's full(~) method creates a new Numpy array whose entries are filled by the specified value.
  • NumPy | full_like method
    Numpy's full_like(~) method creates a Numpy array from an existing array, and fills it with the desired value. This is similar to the other Numpy _like methods such as zeros_like(~) and full_empty(~).
  • NumPy | gcd method
    Numpy's gcd(~) method computes the greatest common denominator of the given values.
  • NumPy | genfromtxt method
    Numpy's genfromtext(~) method reads a text file, and parses its content into a Numpy array. Unlike Numpy's loadtxt(~) method, genfromtxt(~) works with missing numbers.
  • NumPy | geomspace method
    Numpy's geomspace(~) method creates a Numpy array with values that follow a geometric sequence.
  • NumPy | get_printoptions method
    Numpy's get_printoptions(~) method returns a dictionary containing your print options.
  • NumPy | gradient method
    Numpy's gradient(~) method computes the gradients given data points, where the gradient is defined as the changes in y over the changes in x.
  • NumPy | greater method
    Numpy's greater(~) performs an element-wise greater-than (>) comparison given two arrays.
  • NumPy | greater_equal method
    Numpy's greater(~) method performs an element-wise greater-than-or-equal-to (>=) comparison given two arrays.
  • NumPy | histogram method
    NumPy's histogram(~) method computes a histogram (frequency-count diagram).
  • NumPy | hsplit method
    Numpy's hsplit(~) method horizontally splits the input array. A nice way of thinking about this for 2D arrays is is to imagine chopping the array vertically.
  • NumPy | hstack method
    Numpy's hstack(~) method is used to horizontally concatenate arrays.
  • NumPy | hypot method
    Numpy's hypot(~) method computes the hypotenuse given the two sides of the triangle.
  • NumPy | identity method
    Numpy's identity(~) method returns the identity matrix of the specified size.
  • NumPy | iinfo method
    NumPy's iinfo(~) method returns information about a particular NumPy integer data type. Information includes the number of bits occupied by that data type, and the maximum and minimum limits of supported values.
  • NumPy | insert method
    Numpy's insert(~) method returns a new Numpy array with the specified values inserted.
  • NumPy | interp method
    Numpy's interp(~) method computes the linear interpolated values given data points.
  • NumPy | is_busday method
    Numpy's busday(~) method checks whether or not each date string is a valid date. Note that busday stands for business day, but we can specify what a "business" day is via the parameters.
  • NumPy | isclose method
    Numpy's isclose(~) performs an element-wise comparison given two arrays, and for each comparison, returns True if the difference between the two values falls within the specified tolerance.
  • NumPy | iscomplex method
    Numpy's iscomplex(~) method checks whether or not each value in the input array is a complex number.
  • NumPy | iscomplexobj method
    Numpy's iscomplexobj(~) method checks whether the given object contains at least one complex number.
  • NumPy | isfinite method
    Numpy's isfinite(~) method checks whether or not each value in the input array is finite.
  • NumPy | isinf method
    Numpy's inf(~) method checks whether or not each value in the input array is infinite.
  • NumPy | isnan method
    Numpy's isnan(~) method checks whether or not each value in the input array is NaN (i.e. missing value).
  • NumPy | isnat method
    Numpy's isnat(~) method checks whether or not each value in the input array is NaT (i.e. not a time).
  • NumPy | isneginf method
    Numpy's isneginf(~) method checks whether or not each value in the input array is negative infinity.
  • NumPy | isposinf method
    Numpy's isposinf(~) method checks whether or not each value in the input array is positive infinity.
  • NumPy | isreal method
    Numpy's isreal(~) method checks whether or not each value in the input array is real (as opposed to complex numbers).
  • NumPy | isrealobj method
    Numpy's isrealobj(~) method checks whether the given object contains at least one real number.
  • NumPy | isscalar method
    Numpy's isscalar(~) method checks whether if the provided parameter is a scalar.
  • NumPy | item method
    Numpy's item(~) method returns a specific element of the source array as a scalar.
  • NumPy | itemset method
    Numpy's itemset(~) sets a specific value in the source array. This is done in-place, that is, no new Numpy array is created.
  • NumPy | lcm method
    Numpy's lcm(~) method computes the lowest common multiple of the given values.
  • NumPy | less method
    Numpy's less(~) method performs an element-wise less-than (<) comparison given two arrays.
  • NumPy | less_equal method
    Numpy's less_equal(~) method performs an element-wise less-than-or-equal-to (<=) comparison given two arrays.
  • NumPy | lexsort method
    Numpy's lexsort(~) method returns the sorted integer indices of multiple input arrays that correspond to column data. See the examples below for clarification.
  • NumPy | linspace method
    Numpy's linspace(~) method creates a Numpy array with values that are equally spaced. Unlike Numpy's arange(~) method which uses step sizes, linspace(~) uses sample size.
  • NumPy | load method
    Numpy's load(~) method reads a file with extensions .npy and .npz and returns either a memory-map, a Numpy array or a dictionary-like of Numpy arrays.
  • NumPy | loadtxt method
    Numpy's loadtxt(~) method reads a text file, and parses its content into a Numpy array.
  • NumPy | log method
    Numpy's log(~) method computes the natural log of each of the input values.
  • NumPy | log10 method
    Numpy's log10(~) method computes the base-10 logarithm of each of the input values.
  • NumPy | log1p method
    Numpy's log1p(~) method computes log(p+1) (natural logarithm) for each value p in the input array.
  • NumPy | log2 method
    Numpy's log2(~) method computes the base-2 logarithm of each of the input values.
  • NumPy | logaddexp method
    Numpy's logaddexp(~) method computes log(exp(x1)+exp(x2)), where x1 and x2 are the input arrays. This expression is useful because it often crops up in statistics.
  • NumPy | logaddexp2 method
    Numpy's logaddexp2(~) method computes log(2**x1+2**x2), where x1 and x2 are the input arrays.
  • NumPy | logical_and method
    Numpy's logical_and(~) compares the input arrays element-wise, and for each comparison, returns True if both values evaluates to True.
  • NumPy | logical_not method
    Numpy's logical_not(~) whether each value in the input array evaluates to False. A useful interpretation of this method is that it flips the boolean, that is, True become False and vice versa.
  • NumPy | logical_or method
    Numpy's logical_or(~) compares the input arrays element-wise, and for each comparison, returns True if either of the values evaluates to True.
  • NumPy | logical_xor method
    Numpy's logical_xor(~) compares the input arrays element-wise, and for each comparison, returns True if one evaluates to True and the other to False (XOR).
  • NumPy | logspace method
    Numpy's logspace(~) method creates a Numpy array with values that are evenly spaced in a log-scale.
  • NumPy | matmul Method
    Numpy's matmul(~) method is used to perform compute the product of two arrays. These arrays can be vectors, matrices and even higher dimensions.
  • NumPy | max method
    Numpy's max(~) method returns the largest value in the Numpy array. The maximums can also be computed row-wise and column-wise.
  • NumPy | maximum method
    Numpy's maximum() method takes as input two arrays, and performs element-wise comparisons to return a new Numpy array containing the larger value of each pair.
  • NumPy | mean method
    Numpy's mean(~) method computes the mean value along the specified axis.
  • NumPy | median method
    Numpy's median(~) method computes the median along the specified axis.
  • NumPy | meshgrid method
    Numpy's meshgrid(~) method returns a grid that is useful in plotting contour plots of 3D graphs.
  • NumPy | mod method
    Numpy's mod(~) method computes the remainder element-wise given two arrays. Numpy's remainder(~) method is equivalent to this method.
  • NumPy | modf method
    Numpy's modf(~) method returns the fractional part and the integral part for each value in the input array.
  • NumPy | msort method
    Numpy's msort(~) method returns a new copy of the input array that is sorted along the first axis. Note that this method is equivalent to np.sort(array,axis=0).
  • NumPy | multiply method
    Numpy's multiply(~) method performs element-wise multiplication given two arrays.
  • NumPy | nanargmax method
    Numpy's nanargmax(~) method ignores all missing values (i.e. NaNs) returns the index that corresponds to the largest element in the array.
  • NumPy | nanargmin method
    Numpy's nanargmin(~) method ignores all missing values (i.e. NaNs) returns the index that corresponds to the smallest element in the array.
  • NumPy | nanmax method
    Numpy's nanmax(~) method ignores all missing values (i.e. NaNs) and returns the largest value in the Numpy array. The maximums can also be computed row-wise and column-wise.
  • NumPy | nanmin method
    Numpy's nanmin(~) method ignores all missing values and returns the smallest value in the Numpy array. The minimums can also be computed row-wise and column-wise.
  • NumPy | negative method
    Numpy's negative(~) method multiplies every value in the input array by -1. Note that a new Numpy array will be returned.
  • NumPy | not_equal method
    Numpy's not_equal(~) method performs an element-wise not-equal (!=) comparison given two arrays.
  • NumPy | ones method
    Numpy's ones(~) method returns a Numpy array filled with ones.
  • NumPy | percentile method
    Numpy's percentile(~) method returns the interpolated value at the specified percentile.
  • NumPy | place method
    NumPy's place(~) method sets the specified values given a boolean mask.
  • NumPy | positive method
    Numpy's positive(~) method returns a new copy of the input array. This means that modifying this new copy will not have an impact on the original input array. Note that this method does not convert negative values to positive values.
  • NumPy | power method
    Numpy's power(~) method is used to compute the power of each number of the input array.
  • NumPy | prod method
    Numpy's prod(~) computes the product of the values in the input array.
  • NumPy | ptp method
    Numpy's ptp(~) method returns the range (i.e. maximum - minimum) along the specified axis. Note that ptp stands for "peak to peak".
  • NumPy | put method
    Numpy's put(~) sets a specific value in the input array. This is done in-place, that is, no new Numpy array is created.
  • NumPy | put_along_axis method
    Numpy's put_along_axis(~) sets a specific value in the input array. This is done in-place, that is, no new Numpy array is created.
  • NumPy | putmask method
    Numpy's putmask(~) sets a specific value in the input array given a boolean mask. This is done in-place, that is, no new Numpy array is created.
  • NumPy | quantile method
    Numpy's quantile(~) method returns the interpolated value at the specified quantile. Note that this method is exactly the same as the percentile(~), just that the quantile(~) method takes a value between 0 and 1 - not 0 and 100.
  • NumPy | rad2deg method
    Numpy's rad2deg(~) method converts radians to degrees.
  • NumPy | radians method
    Numpy's radians(~) converts degrees to radians.
  • NumPy | randint method
    NumPy's randint() returns a NumPy array of random integers that are in the specified range.
  • NumPy | random method
    Numpy's random() returns a random Float value between 0 (inclusive) and 1 (exclusive).
  • NumPy | random_sample method
    Numpy's random_sample() returns a random Float value between 0 (inclusive) and 1 (exclusive).
  • NumPy | ranf method
    Numpy's ranf() returns a random Float value between 0 (inclusive) and 1 (exclusive).
  • NumPy | ravel method
    Numpy's ravel(~) method flattens the input array and returns its view. This means that modifying the returned flat array would also modify the original input array. If you want to obtain a flattened array that is a separate copy of the input array, then use flatten(~) instead.
  • NumPy | reciprocal method
    Numpy's reciprocal(~) method computes reciprocal (1/x) of each value in the input array.
  • NumPy | remainder method
    Numpy's remainder(~) method computes the remainder element-wise given two arrays. Numpy's mod(~) method is equivalent to this method.
  • NumPy | repeat method
    The np.repeat(~) method is used to create a Numpy array by repeating the provided value.
  • NumPy | reshape method
    Numpy's reshape(~) method returns a new Numpy array with the desired shape. If the reshaped array contains more values than the original array, then numbers will be repeated.
  • NumPy | resize method
    Numpy's resize(~) method returns a new Numpy array with the desired shape. If the reshaped array contains more values than the original array, then numbers will be repeated. This is equivalent to Numpy's reshape(~) method, just without the order parameter.
  • NumPy | rint method
    Numpy's rint(~) method rounds the input values to the nearest integer.
  • NumPy | roll method
    Numpy's roll(~) method shifts an array along the specified axis.
  • NumPy | roots method
    Numpy's roots(~) method returns the roots given the coefficients of the polynomial.
  • NumPy | rot90 method
    Numpy's rot90(~) returns a new Numpy array that is rotated by 90 degrees along the specified axis.
  • NumPy | sample method
    Numpy's sample() returns a random Float value between 0 (inclusive) and 1 (exclusive).
  • NumPy | save method
    Numpy's save(~) method writes a Numpy array to a file in .npy format.
  • NumPy | savetxt method
    Numpy's savetxt(~) method saves a Numpy array as a text file.
  • NumPy | savez method
    Numpy's savez(~) method writes multiple Numpy arrays to a single file in .npz format. Unlike the savez_compressed(~) method, savez(~) merely bundles up the arrays without compression.
  • NumPy | savez_compressed method
    Numpy's savez_compressed(~) method writes multiple Numpy arrays to a single file in .npz format. Unlike the savez(~) method, savez_compressed(~) compresses the file.
  • NumPy | searchsorted method
    Numpy's searchsorted(~) method returns the index of elements if they were to be added in to the sorted array.
  • NumPy Random | seed method
    NumPy Random's seed(~) method is used to generate reproducible results where randomness is involved.
  • NumPy | set_printoptions method
    Numpy's set_printoptions(~) method customizes how Numpy arrays are printed.
  • NumPy | set_string_function method
    Numpy's set_string_function(~) method is used to customize how the string is printed.
  • NumPy | setdiff1d method
    Numpy's setdiff1d(~) method returns the unique values in a that does not exist in b.
  • NumPy | shares_memory method
    Numpy's shares_memory(~) method returns True if the two input arrays share the same memory.
  • NumPy | sign method
    Numpy's sign(~) method returns the sign of each value in the input array.
  • NumPy | signbit method
    Numpy's signbit(~) method checks whether each element in the array is a negative number.
  • NumPy | sin method
    Numpy's sin(~) method computes the sine of each of the input values in radians.
  • NumPy | sort method
    Numpy's sort(~) method returns the sorted copy of the input array. Note that the original array is left intact.
  • NumPy | spacing method
    Numpy's spacing(~) method returns the difference between the next representable adjacent number.
  • NumPy | split method
    Numpy's split(~) method divides up the input array as per the specified parameters.
  • NumPy | sqrt method
    Numpy's sqrt(~) method computes the square root of each value in the input array.
  • NumPy | square method
    Numpy's square(~) method computes the square of each value in the input array, that is, p^2 for every value p.
  • NumPy | squeeze method
    Numpy's squeeze(~) method returns a Numpy array with redundant axises removed. Check the examples below for clarification.
  • NumPy | std method
    Numpy's std(~) method computes the standard deviation of the values in the input array.
  • NumPy | subtract method
    Numpy's subtract(~) method takes in two array and performs an element-wise subtraction.
  • NumPy | sum method
    Numpy's sum(~) computes the sum of the values in the input array.
  • NumPy | swapaxes method
    Numpy's swapaxes(~) method interchanges two axes.
  • NumPy | take method
    Numpy's take(~) method is used to access values, rows and columns of an array.
  • NumPy | tan method
    Numpy's tan(~) method computes the tangent of each of the input values in radians.
  • NumPy | tile method
    Numpy's tile(~) method returns a new Numpy array by repeating the input array by the specified number of times.
  • NumPy | tobytes method
    Numpy's tobytes(~) method returns the byte representation of the source array as a string.
  • NumPy | tolist method
    Numpy's tolist(~) method converts a Numpy array to a standard Python list.
  • NumPy | tostring method
    Numpy's tostring(~) method returns the byte representation of the source array as a string. Note that this method does not simply stringify the array as one might expect, that is, [1,2] does not become "[1,2]".
  • NumPy | transpose method
    Numpy's transpose(~) method flips the rows and columns, just as in the context of matrices.
  • NumPy | tri method
    Numpy's tri(~) method creates a 2D Numpy array that represents a lower triangular matrix. The values at and below the main diagonal are filled with 1s, while everywhere else with 0s.
  • NumPy | tril Method
    Numpy's tril(~) method returns the lower triangle of a matrix as a new Numpy array.
  • NumPy | trim_zeros method
    Numpy's trim_zeros() method returns a new Numpy array with the leading (front) and trailing (back) zeros removed.
  • NumPy | triu Method
    Numpy's triu(~) method returns the upper triangle of a matrix as a new Numpy array.
  • NumPy | true_divide method
    Numpy's true_divide(~) method performs element-wise true division given two arrays. True division means that 5/2=2.5 as opposed to floor division, which is 5//2=2. The methods true_divide(~) and divide(~) are the equivalent.
  • NumPy | trunc method
    Numpy's trunc(~) method removes the decimals of each value in the input array. See examples below for clarification.
  • NumPy | uniform method
    NumPy's random.uniform(~) method samples random values from a uniform distribution. In other words, the method returns an array of random floats.
  • NumPy | unique method
    Numpy's unique(~) method returns a Numpy array containing the sorted unique values of the input array.
  • NumPy | var method
    Numpy's var(~) method computes the variance of values in the input array.
  • NumPy | view method
    NumPy's view(~) method creates a new view of the array with the same data.
  • NumPy | vsplit method
    Numpy's vsplit(~) method vertically splits the input array. A nice way of thinking about this for 2D arrays is is to imagine chopping the array horizontally.
  • NumPy | vstack method
    Numpy's vstack(~) method is used to vertically concatenate arrays.
  • NumPy | where method
    Numpy's where(~) method maps an array of booleans to the specified outputs, similar to how an if-else works.
  • NumPy | zeros method
    Numpy's zeros(~) method creates a Numpy array with all zeros as its entries.
  • NumPy | zeros_like method
    Numpy's zeros_like(~) method creates a Numpy array from an existing array, and fills it with all zeroes. This is similar to the other Numpy _like methods such as full_like(~) and full_empty(~).
  • NumPy | busdaycalendar object
    Numpy's busdaycalendar object encodes user-provided dates that are considered to be valid. Note that busday stands for business day, but we can specify what a "business" day is via the parameters.
  • NumPy | T property
    Numpy's T property returns the transpose of the array.
  • NumPy | base property
    Numpy's base property returns the base object of the array. If object B is derived from object A (i.e. memory location is shared), then object A will be the base of object B.
  • NumPy | data property
    Numpy's data property returns memory location of the start of the array.
  • NumPy | dtype property
    Numpy's dtype property returns data-type of the elements in the array.
  • NumPy | flat property
    Numpy's flat property returns an iterator that represents the flattened version of the array.
  • NumPy | imag property
    Numpy's imag property returns a Numpy array containing the imaginary parts of your array.
  • NumPy | itemsize property
    Numpy's itemsize property returns the memory size of the array's data-type in bytes.
  • NumPy | mgrid property
    Numpy's mgrid property uses [] syntax to create a mesh grid, which is often used to draw contour plots of 3D curves. This is covered in detail in our Numpy's meshgrid(~) documentation here.
  • NumPy | nbytes property
    Numpy's nbytes property returns the memory consumed by all the elements of the array in bytes.
  • NumPy | ndim property
    Numpy's ndim property returns the number of dimensions (or axis) of the array as an int. Note that the notion of dimensions here is not mathematical (e.g. [1,2,3] is a one-dimension array, and not three-dimensional).
  • NumPy | real property
    Numpy's real property returns a Numpy array containing the real parts of your array.
  • NumPy | shape property
    Numpy's shape property returns the number of elements along each axis of the array as a tuple.
  • NumPy | size property
    Numpy's size property returns the number of elements in the array.
  • Char

    • NumPy char | add method
      Numpy's add(~) method takes in two arrays of Strings, and performs pair-wise string concatenation.
    • Method char | capitalize method
      Numpy's capitalize(~) method turns the first character of each input string to uppercase, and the all rest to lowercase (e.g. Hello world).
    • Method char | center method
      Numpy's np.char.center(~) method adds padding to the input strings so that they are of the specified length, and places the strings in the center.
    • NumPy char | count method
      Numpy's count(~) method returns a Numpy array containing the number of occurrences of the given substring in each of the input strings.
    • NumPy | endswith method
      Numpy's endswith(~) method checks whether each string in the input array ends with the specified substring.
    • NumPy char | equal method
      Numpy's np.char.equal(~) method takes as input two arrays of strings, and then performs a pair-wise equal comparison to output a Numpy array of booleans.
    • NumPy | expandtabs method
      Numpy's expandtabs(~) method replaces all instances of "\t" with the specified number of spaces.
    • NumPy char | find method
      Numpy's find(~) method returns the index of the first occurrence of the specified substring in each input string. If not found, -1 is returned.
    • NumPy char | greater method
      Numpy's np.char.greater(~) method takes as input two arrays of strings, and then performs a pair-wise string comparison to output a Numpy array of booleans.
    • NumPy char | greater_equal method
      Numpy's np.char.greater_equal(~) method takes as input two arrays of strings, and then performs a pair-wise string comparison to output a Numpy array of booleans.
    • NumPy | index method
      Numpy's index(~) method returns the index of the first occurrence of the given substring.
    • NumPy | isalnum method
      Numpy's isalnum(~) method checks whether each string of the input array is alphanumeric. Note that this extends to other languages as well.
    • NumPy | isalpha method
      Numpy's isalpha(~) method checks whether each string of the input array is alphabetical. Note that this extends to other languages as well.
    • NumPy | isdecimal method
      Numpy's isdecimal(~) method checks whether each string of the input array is a decimal character.
    • NumPy | isdigit method
      Numpy's isdigit(~) method checks whether each string of the input array is a digit.
    • NumPy | isnumeric method
      Numpy's isnumeric(~) method checks whether each string of the input array is numeric. Unlike the methods isdigit(~) and isdecimal(~), isnumeric(~) also extends to other languages.
    • NumPy char | isupper method
      Numpy's np.char.isupper(~) method takes as input an array of strings, and returns a Numpy array of booleans where True means that all characters of the string are uppercased.
    • NumPy | join method
      Numpy's join(~) method returns a Numpy array of strings where a string in the first array is inserted between every two adjacent characters of a string the second array. Check the examples for clarification.
    • NumPy char | less method
      Numpy's np.char.less(~) method takes as input two arrays of strings, and then performs a pair-wise string comparison to output a Numpy array of booleans.
    • NumPy char | less_equal method
      Numpy's np.char.less_equal(~) method takes as input two arrays of strings, and then performs a pair-wise string comparison to output a Numpy array of booleans.
    • NumPy char | ljust method
      Numpy's np.char.ljust(~) method adds padding to the input strings so that they are of the specified length, and places the strings at the left side.
    • NumPy char | lower method
      Numpy's np.char.lower(~) method takes as input an array and returns a Numpy array with the elements converted to lowercase. Note that the original array is left intact, and a brand new copy of the array is returned.
    • NumPy char | multiply method
      Numpy's multiply(~) method takes in an array of strings as well as an array of integers, and each string is repeated as specified.
    • NumPy char | not_equal method
      Numpy's np.char.not_equal(~) method takes as input two arrays of strings, and then performs a pair-wise not-equal comparison to output a Numpy array of booleans.
    • NumPy | rfind method
      Numpy's rfind(~) method returns the starting index of the last occurrence of the specified substring in each input string. If not found, -1 is returned.
    • NumPy char | rjust method
      Numpy's np.char.rjust(~) method adds padding to the input strings so that they are of the specified length, and places the strings at the right side.
    • NumPy char | rstrip method
      Numpy's np.char.rstrip(~) method takes as input an array of strings, and removes specified characters on the right side of each string.
    • NumPy char | split method
      Numpy's np.char.split(~) method takes as input an array of strings, and applies Python's split(~) method on each string. The split() method partitions a string with specified delimiter (i.e. separator). Note that the original array is left intact, and a brand new copy of the array is returned.
    • NumPy | splitlines method
      Numpy's splitlines(~) method splits each string in the input array by line-break.
    • NumPy | startswith method
      Numpy's startswith(~) method checks whether each string in the input array begins with the specified substring.
    • NumPy char | upper method
      Numpy's np.char.upper(~) method takes as input an array and returns a Numpy array with the elements converted to uppercase. Note that the original array is left intact, and a brand new copy of the array is returned.
    • Method char | zfill method
      Numpy's zfill(~) method left-fills each value of the input array with zeros until the specified width is reached.

    NumPy Random Generator

robocat
Published by Isshin Inada
Edited by 0 others
Did you find this page useful?
thumb_up
thumb_down
Comment
Citation
Ask a question or leave a feedback...
thumb_up
1
thumb_down
0
chat_bubble_outline
0
settings
Enjoy our search
Hit / to insta-search docs and recipes!