**NumPy**

319 guides

*chevron_left*

**NumPy**

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

local_offer

Tags Python●NumPy

*toc*Table of Contents

*expand_more*

Master the

Start your free 7-days trial now!

**mathematics behind data science**with 100+ top-tier guidesStart your free 7-days trial now!

- NumPy | abs methodNumpy's np.abs(~) method returns a Numpy array with the absolute value applied to each of its values.
- NumPy | absolute methodNumpy's np.absolute(~) method returns a Numpy array with the absolute value applied to each of its value.
- NumPy | add methodNumpy's add(~) method takes in two array and performs an element-wise addition.
- NumPy | all methodNumpy'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 methodNumpy'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 methodNumpy's amax(~) method returns the largest value in the Numpy array. The maximums can also be computed row-wise and column-wise.
- NumPy | amin methodNumpy's amin(~) method returns the smallest value in the Numpy array. The minimums can also be computed row-wise and column-wise.
- NumPy | any methodNumpy'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 methodNumpy's append(~) method returns a new Numpy array with the specified values appended to the input array.
- NumPy | arange methodNumpy's arange(~) method is used to create a Numpy array with equally spaced values, similar to Python's range(~) method.
- NumPy | arccos methodNumpy's arccos(~) method computes the inverse cosine of each of the input values in radians.
- NumPy | arcsin methodNumpy's arcsin(~) method computes the inverse sine of each of the input values in radians.
- NumPy | arctan methodNumpy's arctan(~) method computes the inverse tangent of each of the input values in radians.
- NumPy | argmax methodNumpy's argmax(~) method returns the index that corresponds to the largest element in the array.
- NumPy | argmin methodNumpy's argmin(~) method returns the index that corresponds to the smallest element in the array.
- NumPy | argpartition methodNumpy's argparition(~) method is used to partition an array based on ascending order.
- NumPy | argsort methodNumpy's argsort(~) method returns the integer indices of the sorted copy of the input array.
- NumPy | argwhere methodNumpy's argwhere(~) method returns the indices of non-zero values.
- NumPy | around methodNumpy's around(~) method rounds up and down the values in the input array.
- NumPy | array methodNumpy's array(~) method constructs a Numpy array out of the provided object, which is typically a list or a tuple.
- NumPy | array2string methodNumpy's array2string(~) method returns a string representation of your Numpy array formatted as specified.
- NumPy | array_equal methodNumpy's array_equal(~) takes in two arrays and returns True if they have the same shape and elements.
- NumPy | array_equiv methodNumpy's array_equiv(~) takes in two arrays and returns True if they have consistent shape and the same elements.
- NumPy | array_split methodNumpy's array_split(~) method divides up the input array as per the specified parameters.
- NumPy | asarray methodNumpy's asarray(~) method constructs a Numpy array out of the provided object, which is typically a list or a tuple.
- NumPy | asfarray methodNumpy's asfarray(~) converts an array to float type.
- NumPy | asmatrix methodNumpy's asmatrix(~) method constructs a matrix from a sequence of data (e.g. arrays and tuples).
- NumPy | asscalar methodNumpy's asscalar(~) method converts an array of size one to a scalar.
- NumPy | average methodNumpy's average(~) method computes the weighted average along the specified axis.
- NumPy | bincount methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's cbrt(~) method computes the cube-root of of each value in the input array.
- NumPy | ceil methodNumpy's ceil(~) method returns the ceiling for each value in the input array. See examples below for clarification.
- NumPy | choice methodNumPy's choice() method returns an array of random samples.
- NumPy | choose methodNumpy's choose(~) method constructs a new array from a subset of the input array.
- NumPy | clip methodNumpy's clip(~) method is used to ensure that the values of the input array are between a particular range.
- NumPy | compress methodNumpy's compress(~) method extracts a subset of the input values based on the given condition.
- NumPy | corrcoef methodNumpy's corrcoef(~) method computes the Pearson's correlation coefficient given two arrays.
- NumPy | cos methodNumpy's cos(~) method computes the cosine of each of the input values in radians.
- NumPy | count_nonzero methodNumpy's count_nonzero(~) method counts the number of non-zeros in an array along a given axis.
- NumPy | cov methodNumpy's cov(~) method computes the covariance given two arrays.
- NumPy | cross methodNumpy's cross(~) method computes the cross product of two input arrays.
- NumPy | cumprod methodNumpy's cumprod(~) method returns an array holding the cumulative products of the input array.
- NumPy | cumsum methodNumpy's cumsum(~) method returns an array holding the cumulative sums of the input array.
- NumPy | datetime_as_string methodNumpy'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 methodNumpy's datetime_data(~) method extracts information about the unit as well as the step-size.
- NumPy | deg2rad methodNumpy's deg2rad(~) converts degrees to radians.
- NumPy | degrees methodNumpy's degrees(~) method converts radians to degrees.
- NumPy | delete methodNumpy's delete(~) method returns a new Numpy array with the specified values deleted.
- NumPy | diag methodNumpy's diag(~) method returns the diagonal of the input array.
- NumPy | diagflat methodNumpy'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 methodNumpy's diagonal(~) method returns the diagonal of the input array.
- NumPy | diff methodNumpy's diff(~) method computes the difference between each value and its adjacent value in the input array.
- NumPy | digitize methodNumpy'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 methodNumpy'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 methodNumpy'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 MethodNumPy'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 methodNumpy's dstack(~) method is used to concatenate arrays along the third axis.
- NumPy | ediff1d methodNumpy's ediff1d(~) method computes the difference between each value and its adjacent value in the input array.
- NumPy | empty methodNumpy'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 methodNumpy's equal(~) method performs an element-wise equal-to (==) comparison given two arrays.
- NumPy | exp methodNumpy'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 methodNumpy'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 methodNumpy's expand_dims(~) method returns a new Numpy array with dimensions of the input array expanded.
- NumPy | expm1 methodNumpy's expm1(~) method computes exp(p)-1 for each value p in the input array.
- NumPy | extractNumpy's extract(~) method extracts values from the input array that pass the provided criteria.
- NumPy | eye methodNumpy's eye(~) method returns a 2D array with its diagonals filled with 1s, and all other entries filled with 0s.
- NumPy | fabs methodNumpy's np.fabs(~) method returns a Numpy array with the absolute value applied to each of its value.
- NumPy | fill_diagonal methodNumpy'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 methodNumPy'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 methodNumpy's fix(~) method returns the ceiling for negative values and the floor for positive values. See examples below for clarification.
- NumPy | flatnonzero methodNumpy's flatnonzero(~) method returns the indices of non-zero values in the flattened version of the input array.
- NumPy | flatten methodNumpy'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 MethodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's float_power(~) method raises each value in the input array by the specified amount.
- NumPy | floor methodNumpy's floor(~) method returns the floor for each value in the input array. See examples below for clarification.
- NumPy | floor_divide methodNumpy'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 methodNumpy's fmod(~) method computes the remainder element-wise given two arrays.
- NumPy | frombuffer methodNumpy's frombuffer(~) method constructs a Numpy array from a buffer.
- NumPy | fromfunction methodNumpy's fromfunction(~) method constructs a Numpy array using a function that initializes the value for each cell.
- NumPy | fromiter methodNumpy's fromiter(~) method constructs a Numpy array from an iterable object (e.g. lists and strings).
- NumPy | fromstring methodNumpy's fromstring(~) method constructs a Numpy array from the specified string.
- NumPy | full methodNumpy's full(~) method creates a new Numpy array whose entries are filled by the specified value.
- NumPy | full_like methodNumpy'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 methodNumpy's gcd(~) method computes the greatest common denominator of the given values.
- NumPy | genfromtxt methodNumpy'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 methodNumpy's geomspace(~) method creates a Numpy array with values that follow a geometric sequence.
- NumPy | get_printoptions methodNumpy's get_printoptions(~) method returns a dictionary containing your print options.
- NumPy | gradient methodNumpy'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 methodNumpy's greater(~) performs an element-wise greater-than (>) comparison given two arrays.
- NumPy | greater_equal methodNumpy's greater(~) method performs an element-wise greater-than-or-equal-to (>=) comparison given two arrays.
- NumPy | histogram methodNumPy's histogram(~) method computes a histogram (frequency-count diagram).
- NumPy | hsplit methodNumpy'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 methodNumpy's hstack(~) method is used to horizontally concatenate arrays.
- NumPy | hypot methodNumpy's hypot(~) method computes the hypotenuse given the two sides of the triangle.
- NumPy | identity methodNumpy's identity(~) method returns the identity matrix of the specified size.
- NumPy | iinfo methodNumPy'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 methodNumpy's insert(~) method returns a new Numpy array with the specified values inserted.
- NumPy | interp methodNumpy's interp(~) method computes the linear interpolated values given data points.
- NumPy | is_busday methodNumpy'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 methodNumpy'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 methodNumpy's iscomplex(~) method checks whether or not each value in the input array is a complex number.
- NumPy | iscomplexobj methodNumpy's iscomplexobj(~) method checks whether the given object contains at least one complex number.
- NumPy | isfinite methodNumpy's isfinite(~) method checks whether or not each value in the input array is finite.
- NumPy | isinf methodNumpy's inf(~) method checks whether or not each value in the input array is infinite.
- NumPy | isnan methodNumpy's isnan(~) method checks whether or not each value in the input array is NaN (i.e. missing value).
- NumPy | isnat methodNumpy's isnat(~) method checks whether or not each value in the input array is NaT (i.e. not a time).
- NumPy | isneginf methodNumpy's isneginf(~) method checks whether or not each value in the input array is negative infinity.
- NumPy | isposinf methodNumpy's isposinf(~) method checks whether or not each value in the input array is positive infinity.
- NumPy | isreal methodNumpy's isreal(~) method checks whether or not each value in the input array is real (as opposed to complex numbers).
- NumPy | isrealobj methodNumpy's isrealobj(~) method checks whether the given object contains at least one real number.
- NumPy | isscalar methodNumpy's isscalar(~) method checks whether if the provided parameter is a scalar.
- NumPy | item methodNumpy's item(~) method returns a specific element of the source array as a scalar.
- NumPy | itemset methodNumpy'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 methodNumpy's lcm(~) method computes the lowest common multiple of the given values.
- NumPy | less methodNumpy's less(~) method performs an element-wise less-than (<) comparison given two arrays.
- NumPy | less_equal methodNumpy's less_equal(~) method performs an element-wise less-than-or-equal-to (<=) comparison given two arrays.
- NumPy | lexsort methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's loadtxt(~) method reads a text file, and parses its content into a Numpy array.
- NumPy | log methodNumpy's log(~) method computes the natural log of each of the input values.
- NumPy | log10 methodNumpy's log10(~) method computes the base-10 logarithm of each of the input values.
- NumPy | log1p methodNumpy's log1p(~) method computes log(p+1) (natural logarithm) for each value p in the input array.
- NumPy | log2 methodNumpy's log2(~) method computes the base-2 logarithm of each of the input values.
- NumPy | logaddexp methodNumpy'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 methodNumpy's logaddexp2(~) method computes log(2**x1+2**x2), where x1 and x2 are the input arrays.
- NumPy | logical_and methodNumpy's logical_and(~) compares the input arrays element-wise, and for each comparison, returns True if both values evaluates to True.
- NumPy | logical_not methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's logspace(~) method creates a Numpy array with values that are evenly spaced in a log-scale.
- NumPy | matmul MethodNumpy'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 methodNumpy's max(~) method returns the largest value in the Numpy array. The maximums can also be computed row-wise and column-wise.
- NumPy | maximum methodNumpy'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 methodNumpy's mean(~) method computes the mean value along the specified axis.
- NumPy | median methodNumpy's median(~) method computes the median along the specified axis.
- NumPy | meshgrid methodNumpy's meshgrid(~) method returns a grid that is useful in plotting contour plots of 3D graphs.
- NumPy | mod methodNumpy's mod(~) method computes the remainder element-wise given two arrays. Numpy's remainder(~) method is equivalent to this method.
- NumPy | modf methodNumpy's modf(~) method returns the fractional part and the integral part for each value in the input array.
- NumPy | msort methodNumpy'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 methodNumpy's multiply(~) method performs element-wise multiplication given two arrays.
- NumPy | nanargmax methodNumpy's nanargmax(~) method ignores all missing values (i.e. NaNs) returns the index that corresponds to the largest element in the array.
- NumPy | nanargmin methodNumpy's nanargmin(~) method ignores all missing values (i.e. NaNs) returns the index that corresponds to the smallest element in the array.
- NumPy | nanmax methodNumpy'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 methodNumpy'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 methodNumpy's negative(~) method multiplies every value in the input array by -1. Note that a new Numpy array will be returned.
- NumPy | not_equal methodNumpy's not_equal(~) method performs an element-wise not-equal (!=) comparison given two arrays.
- NumPy | ones methodNumpy's ones(~) method returns a Numpy array filled with ones.
- NumPy | percentile methodNumpy's percentile(~) method returns the interpolated value at the specified percentile.
- NumPy | place methodNumPy's place(~) method sets the specified values given a boolean mask.
- NumPy | positive methodNumpy'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 methodNumpy's power(~) method is used to compute the power of each number of the input array.
- NumPy | prod methodNumpy's prod(~) computes the product of the values in the input array.
- NumPy | ptp methodNumpy's ptp(~) method returns the range (i.e. maximum - minimum) along the specified axis. Note that ptp stands for "peak to peak".
- NumPy | put methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's rad2deg(~) method converts radians to degrees.
- NumPy | radians methodNumpy's radians(~) converts degrees to radians.
- NumPy | randint methodNumPy's randint() returns a NumPy array of random integers that are in the specified range.
- NumPy | random methodNumpy's random() returns a random Float value between 0 (inclusive) and 1 (exclusive).
- NumPy | random_sample methodNumpy's random_sample() returns a random Float value between 0 (inclusive) and 1 (exclusive).
- NumPy | ranf methodNumpy's ranf() returns a random Float value between 0 (inclusive) and 1 (exclusive).
- NumPy | ravel methodNumpy'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 methodNumpy's reciprocal(~) method computes reciprocal (1/x) of each value in the input array.
- NumPy | remainder methodNumpy's remainder(~) method computes the remainder element-wise given two arrays. Numpy's mod(~) method is equivalent to this method.
- NumPy | repeat methodThe np.repeat(~) method is used to create a Numpy array by repeating the provided value.
- NumPy | reshape methodNumpy'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 methodNumpy'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 methodNumpy's rint(~) method rounds the input values to the nearest integer.
- NumPy | roll methodNumpy's roll(~) method shifts an array along the specified axis.
- NumPy | roots methodNumpy's roots(~) method returns the roots given the coefficients of the polynomial.
- NumPy | rot90 methodNumpy's rot90(~) returns a new Numpy array that is rotated by 90 degrees along the specified axis.
- NumPy | sample methodNumpy's sample() returns a random Float value between 0 (inclusive) and 1 (exclusive).
- NumPy | save methodNumpy's save(~) method writes a Numpy array to a file in .npy format.
- NumPy | savetxt methodNumpy's savetxt(~) method saves a Numpy array as a text file.
- NumPy | savez methodNumpy'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 methodNumpy'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 methodNumpy's searchsorted(~) method returns the index of elements if they were to be added in to the sorted array.
- NumPy Random | seed methodNumPy Random's seed(~) method is used to generate reproducible results where randomness is involved.
- NumPy | set_printoptions methodNumpy's set_printoptions(~) method customizes how Numpy arrays are printed.
- NumPy | set_string_function methodNumpy's set_string_function(~) method is used to customize how the string is printed.
- NumPy | setdiff1d methodNumpy's setdiff1d(~) method returns the unique values in a that does not exist in b.
- NumPy | shares_memory methodNumpy's shares_memory(~) method returns True if the two input arrays share the same memory.
- NumPy | sign methodNumpy's sign(~) method returns the sign of each value in the input array.
- NumPy | signbit methodNumpy's signbit(~) method checks whether each element in the array is a negative number.
- NumPy | sin methodNumpy's sin(~) method computes the sine of each of the input values in radians.
- NumPy | sort methodNumpy's sort(~) method returns the sorted copy of the input array. Note that the original array is left intact.
- NumPy | spacing methodNumpy's spacing(~) method returns the difference between the next representable adjacent number.
- NumPy | split methodNumpy's split(~) method divides up the input array as per the specified parameters.
- NumPy | sqrt methodNumpy's sqrt(~) method computes the square root of each value in the input array.
- NumPy | square methodNumpy's square(~) method computes the square of each value in the input array, that is, p^2 for every value p.
- NumPy | squeeze methodNumpy's squeeze(~) method returns a Numpy array with redundant axises removed. Check the examples below for clarification.
- NumPy | std methodNumpy's std(~) method computes the standard deviation of the values in the input array.
- NumPy | subtract methodNumpy's subtract(~) method takes in two array and performs an element-wise subtraction.
- NumPy | sum methodNumpy's sum(~) computes the sum of the values in the input array.
- NumPy | swapaxes methodNumpy's swapaxes(~) method interchanges two axes.
- NumPy | take methodNumpy's take(~) method is used to access values, rows and columns of an array.
- NumPy | tan methodNumpy's tan(~) method computes the tangent of each of the input values in radians.
- NumPy | tile methodNumpy's tile(~) method returns a new Numpy array by repeating the input array by the specified number of times.
- NumPy | tobytes methodNumpy's tobytes(~) method returns the byte representation of the source array as a string.
- NumPy | tolist methodNumpy's tolist(~) method converts a Numpy array to a standard Python list.
- NumPy | tostring methodNumpy'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 methodNumpy's transpose(~) method flips the rows and columns, just as in the context of matrices.
- NumPy | tri methodNumpy'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 MethodNumpy's tril(~) method returns the lower triangle of a matrix as a new Numpy array.
- NumPy | trim_zeros methodNumpy's trim_zeros() method returns a new Numpy array with the leading (front) and trailing (back) zeros removed.
- NumPy | triu MethodNumpy's triu(~) method returns the upper triangle of a matrix as a new Numpy array.
- NumPy | true_divide methodNumpy'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 methodNumpy's trunc(~) method removes the decimals of each value in the input array. See examples below for clarification.
- NumPy | uniform methodNumPy's random.uniform(~) method samples random values from a uniform distribution. In other words, the method returns an array of random floats.
- NumPy | unique methodNumpy's unique(~) method returns a Numpy array containing the sorted unique values of the input array.
- NumPy | var methodNumpy's var(~) method computes the variance of values in the input array.
- NumPy | view methodNumPy's view(~) method creates a new view of the array with the same data.
- NumPy | vsplit methodNumpy'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 methodNumpy's vstack(~) method is used to vertically concatenate arrays.
- NumPy | where methodNumpy's where(~) method maps an array of booleans to the specified outputs, similar to how an if-else works.
- NumPy | zeros methodNumpy's zeros(~) method creates a Numpy array with all zeros as its entries.
- NumPy | zeros_like methodNumpy'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 objectNumpy'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 propertyNumpy's T property returns the transpose of the array.
- NumPy | base propertyNumpy'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 propertyNumpy's data property returns memory location of the start of the array.
- NumPy | dtype propertyNumpy's dtype property returns data-type of the elements in the array.
- NumPy | flat propertyNumpy's flat property returns an iterator that represents the flattened version of the array.
- NumPy | imag propertyNumpy's imag property returns a Numpy array containing the imaginary parts of your array.
- NumPy | itemsize propertyNumpy's itemsize property returns the memory size of the array's data-type in bytes.
- NumPy | mgrid propertyNumpy'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 propertyNumpy's nbytes property returns the memory consumed by all the elements of the array in bytes.
- NumPy | ndim propertyNumpy'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 propertyNumpy's real property returns a Numpy array containing the real parts of your array.
- NumPy | shape propertyNumpy's shape property returns the number of elements along each axis of the array as a tuple.
- NumPy | size propertyNumpy's size property returns the number of elements in the array.
- NumPy char | add methodNumpy's add(~) method takes in two arrays of Strings, and performs pair-wise string concatenation.
- Method char | capitalize methodNumpy'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 methodNumpy'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 methodNumpy's count(~) method returns a Numpy array containing the number of occurrences of the given substring in each of the input strings.
- NumPy | endswith methodNumpy's endswith(~) method checks whether each string in the input array ends with the specified substring.
- NumPy char | equal methodNumpy'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 methodNumpy's expandtabs(~) method replaces all instances of "\t" with the specified number of spaces.
- NumPy char | find methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's index(~) method returns the index of the first occurrence of the given substring.
- NumPy | isalnum methodNumpy's isalnum(~) method checks whether each string of the input array is alphanumeric. Note that this extends to other languages as well.
- NumPy | isalpha methodNumpy's isalpha(~) method checks whether each string of the input array is alphabetical. Note that this extends to other languages as well.
- NumPy | isdecimal methodNumpy's isdecimal(~) method checks whether each string of the input array is a decimal character.
- NumPy | isdigit methodNumpy's isdigit(~) method checks whether each string of the input array is a digit.
- NumPy | isnumeric methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy'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 methodNumpy's splitlines(~) method splits each string in the input array by line-break.
- NumPy | startswith methodNumpy's startswith(~) method checks whether each string in the input array begins with the specified substring.
- NumPy char | upper methodNumpy'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 methodNumpy's zfill(~) method left-fills each value of the input array with zeros until the specified width is reached.
- NumPy Random Generator | permutation methodNumPy Random Generator's permutation(~) method return a new array with the values shuffled.
- NumPy Random Generator | permuted methodNumPy Random's permuted(~) method returns a new NumPy array with the values shuffled.
- NumPy Random Generator | shuffle methodNumPy Random Generator's shuffle(~) method randomly shuffles the NumPy array in-place.
- NumPy Random Generator | uniform methodNumPy Random Generator's uniform(~) method draws a random sample from a uniform distribution.

# Char

# NumPy Random Generator

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!