Where To Look
Create an array
- Create a nullable array
- Create a multidimensional table:
darr,@darrto create aDictArray. The latter if you want to convertNAinto appropriate null elements when manually typing. - Create an array with labels:
larr,@larrto create aLabeledArray. The latter if you want to convertNAinto appropriate null elements when manually typing. - Create a nullable array where there are many duplications, i.e. create a pooled/enumeration array:
enumeration,@enumeration
Choose/Remove elements in an array
- Choose elements using index (normal way): index notation(
getindex). - Choose/Remove based on labels in
LabeledArray:extract,discard. - Choose the underlying base of
LabeledArray:peel - Choose the underlying ordered dictionary(
LDict) ofDictArray:peel - Choose field name(s) from
DictArrayorLabeledArray:pick - Choose the axis or axes of
LabeledArray:pickaxis - Remove fields in
DictArray/LabeledArrayor keys inLDict:delete
Select/Update tables in SQL style
- Create new fields and/or aggregating by some fields after choosing some elements based on given conditions:
@select,selct - Update existing fields or append new fields and/or aggregating by some fields after choosing some elements based on given conditions:
@update,update
Join tables
Dealing with NA (null elements)
- Remove
Nullable:igna - Remove
Nullablefrom a nullable boolean array, replacing null elements withfalse:ignabool
Transform arrays
- Changing an array of arrays into an array, expanding the elements of array type along some direction:
ungroup - Make the fields to the last axis in
LabeledArray:flds2axis - Make the last axis to fieldsi in
LabeledArray:axis2flds - Replace the current axes along some directions with some fields
LabeledArray:replace_axes - Flatten some of the middle dimensions in an array:
collapse_axes - Reordering fields:
reorder - Renaming field names:
rename - Tensor product arrays:
tensorprod - Providing/Withdrawing field names to
LabeledArraywhen some of its base or axes are notDictArray:providenames,withdrawnames
Map arrays
- Map a function
felement by element - Map or reduce slices of an array:
mapslices,reducedim - Map values into another values keeping keys or field names the same:
mapvalues
Calculate statistics
-
Available statistical functions:
msum,mprod,mmean,mmedian,mminimum,mmaximum,mmiddle,mquantile -
Fill
NAs forward or backward:nafill - Shift arrays by some amount. Can be used, for example, to obtain previous or next month time series:
shift
Work with DataFrames
- convert to DataFrames:
convert(::DataFrame, ::DictArray),convert(::DataFrame, ::LabeledArray) - convert from DataFrames:
convert(::DictArray, ::DataFrame),convert(::LabeledArray, ::DataFrame),convert(::EnumerationArray, ::DataFrame)
Miscellaneous
- List all field names in a
DictArray:keys - Remove all
NAelements in an array, possibly reducing its size when some elements along some slice are allNA:dropna - Combining two arrays of the same shape. The second one updates the first one only when the element is not
NA:namerge - Want to avoid excessive numbers of parentheses when applying several functions:
@rap. - Create a labels => base value nested dictionary from
LabeledArray:dcube.create_dict - Set elements in an array to
NA:dcube.setna! - Choose whether to display fields along row or column:
alongrow=true/falseoption inshowforDictArrayandshowforLabeledArray. - Take some number of elements repeatedly along some direction in an array:
dcube.gtake. - Drop some number of elements along some direction in an array:
dcube.gdrop. - Set show size when printing
DictArrayandLabeledArrayto console:dcube.set_showalongrow!!,dcube.set_showheight!!,dcube.set_showwidth!!,dcube.set_default_showsize!! - Set display size for html output of
DictArrayandLabeledArray:dcube.set_dispalongrow!!,dcube.set_dispheight!!,dcube.set_dispwidth!!,dcube.set_default_dispsize!!