API Reference¶
Axis¶
|
Represents an axis. |
Exploring¶
Axis.name |
Name of the axis. None in the case of an anonymous axis. |
|
Labels of the axis. |
|
Short representation of the labels. |
|
Data type for the axis labels. |
Searching¶
|
Translates a label key to its numerical index counterpart. |
|
Returns a group with all the labels containing the specified substring. |
|
Returns a group with the labels starting with the specified string. |
|
Returns a group with the labels ending with the specified string. |
|
Returns a group with all the labels matching the specified pattern or regular expression. |
Modifying/Selecting¶
|
Returns a group (list or unique element) of label(s) usable in .sum or .filter |
Allows to define a subset using positions along the axis instead of labels. |
|
|
Split axis into several groups of specified length. |
|
Renames the axis. |
|
Returns an axis for a sub-array. |
|
Append new labels to an axis or increase its length in case of wildcard axis. |
|
Return a new axis with new_labels inserted before before or after after. |
|
Returns a new axis with some labels replaced. |
|
Returns a new axis with the labels transformed by func. |
|
Returns axis with the union of this axis labels and other labels. |
|
Returns axis with the (set) intersection of this axis labels and other labels. |
|
Returns axis with the (set) difference of this axis labels and other labels. |
|
Align axis with other object using specified join method. |
|
Split axis and returns a list of Axis. |
|
Returns a wildcard axis with the same name and length than this axis. |
Testing¶
|
Checks if self is compatible with another axis. |
|
Checks if self is equal to another axis. |
Save¶
|
Writes axis to a HDF file. |
Group¶
IGroup¶
|
Index Group. |
|
Returns group with a different name. |
|
Returns group with a different axis. |
|
Split group into several groups of specified length. |
|
Checks if this group is equal to another group. |
|
compute position(s) of group |
|
Returns (set) union of this label group and other. |
|
Returns (set) intersection of this label group and other. |
|
Returns (set) difference of this label group and other. |
|
Returns a group with all the labels containing the specified substring. |
|
Returns a group with the labels starting with the specified string. |
|
Returns a group with the labels ending with the specified string. |
|
Returns a group with all the labels matching the specified pattern or regular expression. |
|
Writes group to a HDF file. |
LGroup¶
|
Label group. |
|
Returns group with a different name. |
|
Returns group with a different axis. |
|
Split group into several groups of specified length. |
|
Checks if this group is equal to another group. |
|
compute position(s) of group |
|
Returns (set) union of this label group and other. |
|
Returns (set) intersection of this label group and other. |
|
Returns (set) difference of this label group and other. |
|
Returns a group with all the labels containing the specified substring. |
|
Returns a group with the labels starting with the specified string. |
|
Returns a group with the labels ending with the specified string. |
|
Returns a group with all the labels matching the specified pattern or regular expression. |
|
Writes group to a HDF file. |
AxisCollection¶
|
Returns the list of (raw) names of the axes. |
|
Returns the list of (display) names of the axes. |
|
Returns the list of labels of the axes. |
|
Returns the shape of the collection. |
|
Returns the size of the collection, i.e. |
|
Describes the collection (shape and labels for each axis). |
|
|
Returns a copy. |
Searching¶
|
Returns list of all axis names. |
|
Returns the index of axis. |
|
Returns the id of an axis. |
Returns the list of ids of the axes. |
|
|
Returns a view of the axes labels. |
Modifying/Selecting¶
|
Returns axis corresponding to key. |
|
Returns axis corresponding to a key, or to position i if the key has no name and key object not found. |
|
Returns all axes from key if present and length 1 wildcard axes otherwise. |
|
Removes and returns an axis. |
|
Appends axis at the end of the collection. |
|
Extends the collection by appending the axes from axes. |
|
Inserts axis before index. |
|
Renames axes of the collection. |
|
Replace one, several or all axes of the collection. |
|
Replaces the labels of one or several axes. |
|
Returns a new collection without some axes. |
|
Combine several axes into one. |
|
Split axes and returns a new collection |
|
Align this axis collection with another. |
Testing¶
|
Tests if input is an Axis object or the name of an axis contained in self. |
|
Checks if axes passed as argument are compatible with those contained in the collection. |
LArray¶
Overview¶
|
A LArray object represents a multidimensional, homogeneous array of fixed-size items with labeled axes. |
Array Creation Functions¶
|
Creates an array by sequentially applying modifications to the array along axis. |
|
Returns test array with given shape. |
|
Returns an array with the specified axes and filled with zeros. |
|
Returns an array with the same axes as array and filled with zeros. |
|
Returns an array with the specified axes and filled with ones. |
|
Returns an array with the same axes as array and filled with ones. |
|
Returns an array with the specified axes and uninitialized (arbitrary) data. |
|
Returns an array with the same axes as array and uninitialized (arbitrary) data. |
|
Returns an array with the specified axes and filled with fill_value. |
|
Returns an array with the same axes and type as input array and filled with fill_value. |
Copying¶
|
Returns a copy of the array. |
|
Copy of the array, cast to a specified type. |
Inspecting¶
LArray.data |
Data of the array (Numpy ndarray) |
LArray.axes |
Axes of the array (AxisCollection) |
LArray.title |
Title of the array (str) |
Describes a LArray (metadata + shape and labels for each axis). |
|
Returns the shape of the array as a tuple. |
|
Returns the number of dimensions of the array. |
|
Returns the type of the data of the array. |
|
Returns the number of elements in array. |
|
Returns the number of bytes used to store the array in memory. |
|
Returns the memory consumed by the array in human readable form. |
Modifying/Selecting¶
Allows selection of a subset using indices of labels. |
|
Allows selection of arbitrary items in the array based on their N-dimensional label index. |
|
Allows selection of arbitrary items in the array based on their N-dimensional index. |
|
Access the array by index as if it was flat (one dimensional) and all its axes were combined. |
|
|
Sets a subset of array to value. |
|
Return array without some labels or indices along an axis. |
|
Ignore labels from axes (replace those axes by “wildcard” axes). |
|
Filters the array along the axes given as keyword arguments. |
|
Apply a transformation function to array elements. |
|
Apply a transformation mapping to array elements. |
Changing Axes or Labels¶
|
Replace one, several or all axes of the array. |
|
Renames axes of the array. |
|
Replaces the labels of one or several axes of the array. |
|
Combine several axes into one. |
|
Split axes and returns a new array |
|
Reverse axes of an array |
Aggregation Functions¶
|
Computes the sum of array elements along given axes/groups. |
|
Computes the sum of array elements for the given axes/groups. |
|
Computes the product of array elements along given axes/groups. |
|
Computes the product of array elements for the given axes/groups. |
|
Returns the cumulative sum of array elements along an axis. |
|
Returns the cumulative product of array elements. |
|
Computes the arithmetic mean. |
|
Computes the arithmetic mean. |
|
Computes the arithmetic median. |
|
Computes the arithmetic median. |
|
Computes the unbiased variance. |
|
Computes the unbiased variance. |
|
Computes the sample standard deviation. |
|
Computes the sample standard deviation. |
|
Computes the qth percentile of the data along the specified axis. |
|
Computes the qth percentile of the data for the specified axis. |
|
Returns the range of values (maximum - minimum). |
|
Add aggregated values (sum by default) along each axis. |
|
Returns an array with values given as percent of the total of all values along given axes. |
|
Returns an array with all values divided by the sum of values along given axes. |
|
Returns a LArray with values array / array.sum(axes) where the sum is not 0, 0 otherwise. |
|
Calculates the growth along a given axis. |
|
Descriptive summary statistics, excluding NaN values. |
|
Descriptive summary statistics, excluding NaN values, along axes or for groups. |
Sorting¶
|
Sorts axes of the array. |
|
Sorts values of the array. |
|
Returns the labels that would sort this array. |
|
Returns the indices that would sort this array. |
Reshaping/Extending/Reordering¶
|
Given a list of new axes, changes the shape of the array. |
|
Same as reshape but with an array as input. |
|
Detects and removes “useless” axes (ie axes for which values are constant over the whole axis) |
|
Reorder and/or add new labels in axes. |
|
Reorder axes. |
|
Expands array to target_axes. |
|
Adds an array before self along an axis. |
|
Adds an array to self along an axis. |
|
Adds an array to self along an axis. |
|
Inserts value in array along an axis. |
|
Returns an array that is (NumPy) broadcastable with target. |
|
Align two arrays on their axes with the specified join method. |
Testing/Searching¶
|
Compares self with another array and returns True if they have the same axes and elements, False otherwise. |
|
Compares self with another array element-wise and returns an array of booleans. |
|
Computes whether each element of this array is in test_values. |
|
Returns the indices of the elements that are non-zero. |
|
Test whether all selected elements evaluate to True. |
|
Test whether all selected elements evaluate to True. |
|
Test whether any selected elements evaluate to True. |
|
Test whether any selected elements evaluate to True. |
|
Get minimum of array elements along given axes/groups. |
|
Get minimum of array elements for the given axes/groups. |
|
Get maximum of array elements along given axes/groups. |
|
Get maximum of array elements for the given axes/groups. |
|
Returns labels of the minimum values along a given axis. |
|
Returns indices of the minimum values along a given axis. |
|
Returns labels of the maximum values along a given axis. |
|
Returns indices of the maximum values along a given axis. |
Iterating¶
|
Returns a view on the array labels along axes. |
|
Returns a view on the values of the array along axes. |
|
Returns a (label, value) view of the array along axes. |
Operators¶
|
Matrix multiplication |
Miscellaneous¶
|
Divides array by other, but returns 0.0 where other is 0. |
|
Clip (limit) the values in an array. |
|
Shifts the cells of the array n-times to the right along axis. |
|
Rolls the cells of the array n-times to the right along axis. |
|
Calculates the n-th order discrete difference along a given axis. |
|
Returns unique values (optionally along axes) |
|
Sends the content of the array to clipboard. |
Converting to Pandas objects¶
|
Converts LArray into Pandas Series. |
|
Converts LArray into Pandas DataFrame. |
Plotting¶
Plots the data of the array into a graph (window pop-up). |
Utility Functions¶
Miscellaneous¶
|
Return elements, either from x or y, depending on condition. |
|
Element-wise maximum of array elements. |
|
Element-wise minimum of array elements. |
|
Compute the (multiplicative) inverse of a matrix. |
|
One-dimensional linear interpolation. |
|
Returns the discrete, linear convolution of two one-dimensional sequences. |
|
Calculate the absolute value element-wise. |
|
Compute the absolute values element-wise. |
|
Test element-wise for NaN and return result as a boolean array. |
|
Test element-wise for positive or negative infinity. |
|
Replace NaN with zero and infinity with large finite numbers (default behaviour) or with the numbers defined by the user using the nan, posinf and/or neginf keywords. |
|
Return the non-negative square-root of an array, element-wise. |
|
Modified Bessel function of the first kind, order 0. |
|
Return the sinc function. |
Rounding¶
|
Round an array to the given number of decimals. |
|
Return the floor of the input, element-wise. |
|
Return the ceiling of the input, element-wise. |
|
Return the truncated value of the input, element-wise. |
|
Round elements of the array to the nearest integer. |
|
Round to nearest integer towards zero. |
Exponents And Logarithms¶
|
Calculate the exponential of all elements in the input array. |
|
Calculate |
|
Calculate 2**p for all p in the input array. |
|
Natural logarithm, element-wise. |
|
Return the base 10 logarithm of the input array, element-wise. |
|
Base-2 logarithm of x. |
|
Return the natural logarithm of one plus the input array, element-wise. |
|
Logarithm of the sum of exponentiations of the inputs. |
|
Logarithm of the sum of exponentiations of the inputs in base-2. |
Trigonometric functions¶
|
Trigonometric sine, element-wise. |
|
Cosine element-wise. |
|
Compute tangent element-wise. |
|
Inverse sine, element-wise. |
|
Trigonometric inverse cosine, element-wise. |
|
Trigonometric inverse tangent, element-wise. |
|
Given the “legs” of a right triangle, return its hypotenuse. |
|
Element-wise arc tangent of |
|
Convert angles from radians to degrees. |
|
Convert angles from degrees to radians. |
|
Unwrap by changing deltas between values to 2*pi complement. |
Hyperbolic functions¶
|
Hyperbolic sine, element-wise. |
|
Hyperbolic cosine, element-wise. |
|
Compute hyperbolic tangent element-wise. |
|
Inverse hyperbolic sine element-wise. |
|
Inverse hyperbolic cosine, element-wise. |
|
Inverse hyperbolic tangent element-wise. |
Complex Numbers¶
|
Return the angle of the complex argument. |
|
Return the real part of the complex argument. |
|
Return the imaginary part of the complex argument. |
|
Return the complex conjugate, element-wise. |
Floating Point Routines¶
|
Returns element-wise True where signbit is set (less than zero). |
|
Change the sign of x1 to that of x2, element-wise. |
|
Decompose the elements of x into mantissa and twos exponent. |
|
Returns x1 * 2**x2, element-wise. |
Metadata¶
An ordered dictionary allowing key-values accessibly using attribute notation (AttributeDict.attribute) instead of key notation (Dict[“key”]). |
Input/Output¶
Read¶
|
Reads csv file and returns an array with the contents. |
|
|
|
Reads excel file from sheet name and returns an LArray with the contents |
|
Reads an axis or group or array named key from a HDF5 file in filepath (path+name) |
|
Reads EUROSTAT TSV (tab-separated) file into an array. |
|
Reads sas file and returns an LArray with the contents |
|
Reads Stata .dta file and returns an LArray with the contents |
Write¶
|
Writes array to a csv file. |
|
Writes array in the specified sheet of specified excel workbook. |
|
Writes array to a HDF file. |
|
Writes array to a Stata .dta file. |
|
Dump array as a 2D nested list. |
Excel¶
|
Open an Excel workbook |
|
Excel Workbook. |
|
Returns the names of the Excel sheets. |
|
Saves the Workbook. |
|
Close the workbook in Excel. |
|
Return the Excel instance this workbook is attached to. |
ExcelReport¶
Automate the generation of multiple graphs in an Excel file. |
|
Set the path to the directory containing the Excel template files (with ‘.crtx’ extension). |
|
Set a default Excel template file. |
|
|
Override the default ‘width’ and ‘height’ values for the given kind of item. |
Default number of graphs per row. |
|
|
Add a new empty output sheet. |
|
Returns the names of the output sheets. |
|
Generate the report Excel file. |
ReportSheet¶
Represents a sheet dedicated to contains only graphical items (title banners, graphs). |
|
Set the path to the directory containing the Excel template files (with ‘.crtx’ extension). |
|
Set a default Excel template file. |
|
|
Override the default ‘width’ and ‘height’ values for the given kind of item. |
Default number of graphs per row. |
|
|
Add a title item to the current sheet. |
|
Add a graph item to the current sheet. |
|
Add multiple graph items to the current sheet. |
|
Force a new row of graphs. |
Miscellaneous¶
|
Converts input as LArray if possible. |
|
Converts Pandas DataFrame into LArray. |
|
Converts Pandas Series into LArray. |
|
Return absolute path to an example file if exist. |
|
Set options for larray in a controlled context. |
Return the current options. |
|
|
Returns an array with specified axes and the combination of corresponding labels as values. |
|
Returns the union of several “value strings” as a list. |
|
Combines several arrays or sessions along an axis. |
|
|
|
Extracts a diagonal or construct a diagonal array. |
|
Returns a 2-D array with ones on the diagonal and zeros elsewhere. |
|
Apply Iterative Proportional Fitting Procedure (also known as bi-proportional fitting in statistics, RAS algorithm in economics) to array a, with target_sums as targets. |
Wrap a function using numpy arrays to work with LArray arrays instead. |
|
|
Returns a sequence as if simultaneously iterating on several arrays. |
|
Returns a sequence as if simultaneously iterating on several arrays as well as the current iteration “key”. |
Session¶
|
Groups several objects together. |
|
Returns a session containing all available arrays (whether they are defined in local or global variables) sorted in alphabetical order. |
|
Returns a session containing all local arrays sorted in alphabetical order. |
|
Returns a session containing all global arrays sorted in alphabetical order. |
|
Load arrays used in the tutorial so that all examples in it can be reproduced. |
Exploring¶
Returns the list of names of the objects in the session. |
|
|
Returns a view on the session’s keys. |
|
Returns a view on the session’s values. |
|
Returns a view of the session’s items ((key, value) pairs). |
|
Returns a summary of the content of the session. |
Copying¶
|
Returns a copy of the session. |
Testing¶
|
Test if each element (group, axis and array) of the current session equals the corresponding element of another session. |
|
Test if all elements (groups, axes and arrays) of the current session are equal to those of another session. |
Selecting¶
|
Returns the object corresponding to the key. |
Modifying¶
|
Adds objects to the current session. |
|
Update the session with the key/value pairs from other or passed keyword arguments, overwriting existing keys. |
|
Returns the object corresponding to the key. |
|
Apply function func on elements of the session and return a new session. |
|
Reorder axes of arrays in session, ignoring missing axes for each array. |
Filtering/Cleaning¶
|
Returns a new session with objects which match some criteria. |
|
Detects and removes “useless” axes (ie axes for which values are constant over the whole axis) for all array objects in session |
Load/Save¶
|
Load LArray, Axis and Group objects from a file, or several .csv files. |
|
Dumps LArray, Axis and Group objects from the current session to a file. |
|
Dumps LArray, Axis and Group objects from the current session to CSV files. |
|
Dumps LArray, Axis and Group objects from the current session to an Excel file. |
|
Dumps LArray, Axis and Group objects from the current session to an HDF file. |
|
Dumps LArray, Axis and Group objects from the current session to a file using pickle. |
Editor¶
|
Opens a new viewer window. |
|
Opens a new editor window. |
|
Opens a new comparator window, comparing arrays or sessions. |
|
Runs the editor when an unhandled exception (a fatal error) happens. |
Random¶
|
Return random integers from low (inclusive) to high (exclusive). |
|
Draw random samples from a normal (Gaussian) distribution. |
|
Draw samples from a uniform distribution. |
|
Randomly permute a sequence along an axis, or return a permuted range. |
|
Generates a random sample from given choices |