Transformations
This documentation covers the technical requirements for each transformation in Rose. If you are new to using Rose, we recommend reading Using Functions first.
timeseries
:a
Resample timeseries frequency to yearly. Shorthand for the :resample(a, last, ffill) transformation.
Input type: timeseries
Output type: timeseries
Parameters:
none
:abs
Calculates the absolute value of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
none
:add
Adds a singular value to each point in a timeseries or the corresponding point-in-time values from another timeseies.
Input type: timeseries
Output type: timeseries
Parameters:
value: float or rosecode
Float: number to be added to each row of a timeseries, Rosecode: timeseries used to add corresponding values to current timeseries.
:addfilled
Add a singular value or timeseries to the current timeseries with missing values filled with zeroes.
Input type: timeseries
Output type: timeseries
Parameters:
value: rosecode or integer
Another rosecode or an integer
:annualizedreturn
Calculates the annualized return from a returns series.
Input type: timeseries
Output type: timeseries
Parameters:
none
:annualizedvol
Calculates the annualized volatility from a returns series.
Input type: timeseries
Output type: timeseries
Parameters:
none
:b
Resample timeseries frequency to business days. Shorthand for the :resample(b, last, ffill) transformation.
Input type: timeseries
Output type: timeseries
Parameters:
none
:bfill
Backfills gaps in timeseries data with the closest value after the missing data.
Input type: timeseries
Output type: timeseries
Parameters:
none
:change
Calculates the level or percent change in values of a timeseries, specifying the date interval type and number of date intervals between calculations.
Input type: timeseries
Output type: timeseries
Parameters:
frequency [optional] : string
Data interval type: Daily (d), Weekly (w), Monthly (m), Quarterly (q), Yearly (y or a).
change type [optional] : string, default= ari
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
change periods [optional] : int
Number of data intervals between each calculation.
:corr
Calculates the correlation between two timeseries.
Input type: timeseries
Output type: map
Parameters:
timeseries: rosecode
A rosecode of a timeseries
:cum
Calculates the compounding cumulative product of decimal or percentage values; for example, a returns series.
Input type: timeseries
Output type: timeseries
Parameters:
none
:cumsum
Calculates the rolling cumulative sum of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
none
:d
Resample timeseries frequency to daily. Shorthand for the :resample(d, last, ffill) transformation.
Input type: timeseries
Output type: timeseries
Parameters:
none
:div
Divide a timeseries by another timeseries or single value.
Input type: timeseries
Output type: timeseries
Parameters:
value: rosecode or integer
Another rosecode or an integer
:dod
Calculates the day-over-day level or percent (default) change in values of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
change type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:drawdown
Calculates the drawdown (percent difference from the last maximum value) of a return series.
Input type: timeseries
Output type: timeseries
Parameters:
none
:drop
Drop a specific number from the timeseries
Input type: timeseries
Output type: timeseries
Parameters:
value: float
Number to be dropped.
:duration
Calculates the duration of a timeseries assuming the timeseries is the yield to maturity (YTM) of a bond.
Input type: timeseries
Output type: timeseries
Parameters:
par: int
Par (face) value of the bond.
maturity: int
Number of years to maturity.
coupon: float or rosecode
Annual coupon rate in percentage points. (ex. 3.125% -> 3.125)
coupon frequency: int
Number of coupon periods per year.
:enddate
Truncates a timeseries starting at a given date (removes all data after the date). :until and :enddate are synonymous transformations.
Input type: timeseries
Output type: timeseries
Parameters:
date: string
Date format can be YYYY, YYYYMMDD or YYYY.MM.DD
:eom
Resample timeseries frequency to monthly (end-of-month). Shorthand for the :resample(m, last, bfill) transformation. Key difference between :eom
and :m
is the fill direction.
Input type: timeseries
Output type: timeseries
Parameters:
none
:ewm
Calculates the exponential moving average on timeseries
Input type: timeseries
Output type: timeseries
Parameters:
decay type: string
com: Specify decay in terms of center of mass
span: Specify decay in terms of span
halflife: Specify decay in terms of half-life
alpha: Specify smoothing factor (alpha) directly
decay value: float
Value for the decay, dependant on the decay type.
aggregation type: string
Mean or standard deviation (std)
minimum periods [optional] : int, default= 0
Minimum number of observations in window required to have a value
adjust [optional] : int, default= 1
Divide by decaying adjustment factor in beginning periods to account for imbalance in relative weightings (viewing EWMA as a moving average).
:extendfrom
Extends the timeseries back in time to the given date. Back fills using the first datapoint available.
Input type: timeseries
Output type: timseries
Parameters:
date: date
Date format can be YYYY, YYYYMMDD or YYYY.MM.DD
:ffill
Forwardfills gaps in timeseries data with the closest value before the missing data.
Input type: timeseries
Output type: timeseries
Parameters:
none
:filltoday
Extends the timeseries to current date, using the last value available to fill the gap. Optional frequency can be provided.
Input type: timeseries
Output type: timeseries
Parameters:
frequency [optional] : string, default= none
Data interval type: Daily (d), Weekly (w), Monthly (m), Quarterly (q), Yearly (y or a).
:flip
Multiplies a timeseries by -1.
Input type: timeseries
Output type: timeseries
Parameters:
none
:hackyduration
Calculates the duration for a timeseries given the maturity of a bond with the assumption that the timeseries is a zero coupon bond yield
Input type: timeseries
Output type: timeseries
Parameters:
maturity [optional] : integer, default= none
Maturity of the bond in years.
:inferlag
Calculates the number of days between the last datapoint of the timeseries and the current date.
Input type: timeseries
Output type: map
Parameters:
none
:interpolate
A tool for filling in missing data in a timeseries for a specific date using a given method.
Input type: timeseries
Output type: timeseries
Parameters:
date: date
Where in the timeseries to perform the interpolation.
method: string
Method options include: nearest,zero,slinear,quadratic,cubic,barycentric,polynomial
order [optional] : integer, default= none
Axis to interpolate along. Options are: 0 for ‘index’ or 1 for ‘columns’
:inv
Calculates the inverse (1/x) of a timeseries
Input type: timeseries
Output type: timeseries
Parameters:
none
:kalman
Filters noise out of a timeseries using a Kalman (also known as a linear quadratic estimation (LQE)) algorithm.
Input type: timeseries
Output type: timeseries
Parameters:
none
:last
Get the last value of a timeseries.
Input type: timeseries
Output type: map
Parameters:
none
:log
Calculates the natural logarithm of a line
Input type: timeseries
Output type: timeseries
Parameters:
none
:logic
Returns the underlying logic of the rosecode.
Input type: timeseries
Output type: map
Parameters:
none
:m
Resample timeseries frequency to monthly (end-of-month). Shorthand for the :resample(m, last, ffill) transformation.
Input type: timeseries
Output type: timeseries
Parameters:
none
:ma
Calculates the moving average over a timeseries or calculates change over two moving windows if a second window is provided (adjusted for date interval frequency and difference between windows).
Input type: timeseries
Output type: timeseries
Parameters:
first_window: int
Number of data intervals between each calculation.
second_window [optional] : int
Number of data intervals between each calculation.
change_type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:max
Creates an upper limit for a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
upper limit: float
Number to be the maximum value of any datapoint in the timeseries.
:mean
Calculates the arithmetic average value across a timeseries.
Input type: timeseries
Output type: map
Parameters:
none
:metas
Returns metadata of a rosecode.
Input type: timeseries
Output type: map
Parameters:
none
:min
Creates a lower limit for a timeseries
Input type: timeseries
Output type: timeseries
Parameters:
lower limit: float
Number to be the maximum value of any datapoint in the timeseries.
:mom
Calculates the month-over-month level or percent (default) change in values of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
change type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:mult
Multiplies a singular value to each point in a timeseries or the corresponding point-in-time values from another timeseies.
Input type: timeseries
Output type: timeseries
Parameters:
value: float or rosecode
Value for each point in the timeseries to by mulitplied by.
:offset
Shift a timeseries by the specified number of periods.
Input type: timeseries
Output type: timeseries
Parameters:
offset amount: int
How many periods to offset the data; can be positive or negative.
:optimaloffset
Calculate the optimal offset of two timeseries in a given window
Input type: timeseries
Output type: map
Parameters:
secondary timeseries: rosecode
A rosecode of a timeseries
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
offset method [optional] : int, default= none
Single or bi-directional. 0=single direction, 1=bi-directional.
:optionpricer
Calculates different attributes of an option given a price series. The default is the price of the option contract, other attributes include delta, gamma, vega, rho, and return.
Input type: timeseries
Output type: timeseries
Parameters:
option type: string
The type of the option, options include call or put.
strike: float
The price to execute the option at.
implied vol: float or rosecode
The implied volatility, either as a single value (ex. 0.33) or as a timeseries.
interest rate: float or rosecode
The risk free interest rate, either as a single value (ex. 0.02) or a timeseries.
time to maturity: float
The days until maturity before the option rolls.
model type [optional] : string, default= bs
The type of model to use, options inlcude: bs (Black-Scholes), gk (Garman-Kohlhagen), or me (Merton).
return type [optional] : string, default= price
The type of attribute to return, option include price, delta, theta, gamma, vega, rho, and return.
burn_per_period [optional] : float or rosecode, default= none
Optional burn rate for the gk and me models, either as a single value (ex. 0.02) or a timeseries.
:pow
Raises each row in a timeseries to a singular value or the corresponding row values of another timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
value: float or rosecode
Value for the timeseries to be raised to.
:q
Resample timeseries frequency to quarterly (end-of-quarter). Shorthand for the :resample(q, last, ffill) transformation.
Input type: timeseries
Output type: timeseries
Parameters:
none
:qoq
Calculates the quarter-over-quarter level or percent (default) change in values of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
change type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:replacewith
Replaces the current timeseries with one provided
Input type: timeseries
Output type: timeseries
Parameters:
timeseries: rosecode
A rosecode of a timeseries
:resample
Resamples data to a certain frequency with options on which values to use if upsampling (going from daily -> monthly) and how to fill for downsampling (going from monthly -> daily).
Input type: timeseries
Output type: timeseries
Parameters:
frequency: string
Daily (d), Weekly (w), Monthly (m), Quarterly (q), Yearly (y or a).
resample type [optional] : string, default= last
Which instance in the period to use as the value.
fill type [optional] : string, default= ffill
How to fill gaps in the data. ffill = forward fill (using the last value), bfill = back fill (using the next value), or zero (using 0)
:rescaletofirstval
Rescale the timeseries by a given first value.
Input type: timeseries
Output type: timeseries
Parameters:
rescale value: float or rosecode
The value to set the first value of the timeseries to.
rescale type [optional] : string, default= geo
Method of calculating the rescaling. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:rescaletolastval
Rescale the timeseries by a given last value.
Input type: timeseries
Output type: timeseries
Parameters:
rescale value: float or rosecode
The value to set the last value of the timeseries to.
rescale type [optional] : string, default= geo
Method of calculating the rescaling. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:return
Calculates the cumulative return on a returns series. The cumulative return is the total change over time; it is an aggregate return, not an annualized one.
Input type: timeseries
Output type: timeseries
Parameters:
none
:returnfrom
Calculates the cumulative return on a price or index series from a given date
Input type: timeseries
Output type: timeseries
Parameters:
start date: date
Date format can be YYYY, YYYYMMDD or YYYY.MM.DD
:returns
Calculates the geometric change of a timeseries (value2 / value1).
Input type: timeseries
Output type: timeseries
Parameters:
frequency [optional] : string
Data interval type: Daily (d), Weekly (w), Monthly (m), Quarterly (q), Yearly (y or a).
:revol
Adjusts the volatility of a returns series to a given value.
Input type: timeseries
Output type: timeseries
Parameters:
volatility: float
:rollcum
Calculates the compounding cumulative product over a sliding partition of decimal or percentage values; for example, a returns series.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Length of partition to look back from the current observation.
:rollsharpe
Calculates the rolling sharpe ratio of a timeseries. Note: the rosecode should be a returns series.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
:rollskew
Calculate the unbiased rolling skew normalized by N-1 in a given window.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
:rollstd
Calculates the rolling standard deviation over a given window.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
:rollsum
Calculates the rolling sum over a given window.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
:rollz
Calculates the rolling Z score for a timeseries over a given window. A rolling Z-score is based on the average and standard deviation of the data in the window.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
:rollzback
Calculates Z score for line over a rolling window average and standard deviation. For data that doesn't fit into the window, the available data will be used for mean and standard deviation
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of observations in the window. For example, a quarterly window for a business daily series would be 84, but only 3 for a monthly series.
:round
Round values in a timeseries to specified number of decimal places.
Input type: timeseries
Output type: timeseries
Parameters:
decimals_to_round [optional] : int
Number of decimals to round to.
:rsi
Calculates the rolling Relative Strength Index (RSI) over a given window. Note: the rosecode should be a returns series.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of data points between each calculation.
:rv
Calculates the rolling Realized Volatility of a timeseries over a given window. Note: the rosecode should be a price series.
Input type: timeseries
Output type: timeseries
Parameters:
window: int
Number of data points between each calculation.
:sa
Seasonally adjusts a timeseries using ARIMA x13
Input type: timeseries
Output type: timeseries
Parameters:
none
:seasonalityfactor
Resamples timeseries to a given frequency and calculate seasonality factor. For the best results, use the frequency closest to the dataset.
Input type: timeseries
Output type: timeseries
Parameters:
frequency [optional] : string, default= none
Data interval type: Daily (d), Weekly (w), Monthly (m), Quarterly (q), Yearly (y or a).
:sharpe
Calculates the sharpe ratio of a timeseries assuming it's a daily returns timeseries
Input type: timeseries
Output type: timeseries
Parameters:
none
:signal
Converts the timeseries to a signal from -1 to 1 using a cumulative density function
Input type: timeseries
Output type: timeseries
Parameters:
none
:since
Truncates a timeseries starting at a given date (removes all data before the date). :since and :startdate are synonymous transformations.
Input type: timeseries
Output type: timeseries
Parameters:
date: string
Date format can be YYYY, YYYYMMDD or YYYY.MM.DD
:skew
Calculates the unbiased skew normalized by N-1. Returns a timeseries with a single value.
Input type: timeseries
Output type: timeseries
Parameters:
none
:sortino
Calculates the Sortino ratio of a returns series based on a given minimum acceptable return. Returns a timeseries with a single value. The Sortino ratio measures the risk-adjusted return of an investment asset, portfolio, or strategy.
Input type: timeseries
Output type: timseries
Parameters:
minimum acceptable return [optional] : float, default= 0
The desired percent return. Example: 10% -> 0.1
:spearmancorr
Calculates spearman correlation of two timeseries.
Input type: timeseries
Output type: map
Parameters:
timeseries: rosecode
A rosecode of a timeseries
:splice
Splices the changes of another timeseries to the back of the current timeseries
Input type: timeseries
Output type:
Parameters:
timeseries: rosecode
another rosecode of a timeseries that extend ...
change type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
extend type [optional] : string, default= regular
an indicator of ..
:startdate
Truncates a timeseries starting at a given date (removes all data before the date). :since and :startdate are synonymous transformations.
Input type: timeseries
Output type: timeseries
Parameters:
date: string
Date format can be YYYY, YYYYMMDD or YYYY.MM.DD
:std
Calculates the standard deviation over an entire timeseries as a singular value.
Input type: timeseries
Output type: map
Parameters:
none
:stitch
Overlay another timeseries on top of the current timeseries and return the combined timeseries
Input type: timeseries
Output type: timeseries
Parameters:
timeseries: rosecode, default= none
A rosecode of a timeseries to be stitched to the base rosecode.
:sub
Subtracts a singular value to each point in a timeseries or the corresponding point-in-time values from another timeseies.
Input type: timeseries
Output type: timeseries
Parameters:
value: float or rosecode
Float: number to be subtracted from each point of a timeseries, Rosecode: timeseries used to subtract corresponding values to current timeseries.
:tomap
Convert a timeseries to a map with a column of dates and a cloumn of values
Input type: timeseries
Output type: map
Parameters:
none
:trade
Calculate the return when using the first timeseries as signal to trade a returns series
Input type: timeseries
Output type: timeseries
Parameters:
returns series : rosecode
The returns (percent change) series to trade based on the signal series.
transaction cost [optional] : float, default= none
If given, the fee (in decimals) deducted for each trade.
trading trigger [optional] : float, default= none
If given, the threshold that the signal must pass before a trade is executed.
:until
Truncates a timeseries starting at a given date (removes all data after the date). :until and :enddate are synonymous transformations.
Input type: timeseries
Output type: timeseries
Parameters:
date: string
Date format can be YYYY, YYYYMMDD or YYYY.MM.DD
:w
Resample timeseries frequency to weekly. Shorthand for the :resample(w, last, ffill) transformation.
Input type: timeseries
Output type: timeseries
Parameters:
none
:wow
Calculates the week-over-week level or percent (default) change in values of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
change type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:yoy
Calculates the year-over-year level or percent (default) change in values of a timeseries.
Input type: timeseries
Output type: timeseries
Parameters:
change type [optional] : string, default= geo
Method of calculating the change between two values. Options include percent change (geo, pct, percent) and level change (ari, lvl, level).
:ytmtoprice
Calculates the price of a bond timeseries assuming the timeseries is the yield to maturity (YTM) of a bond
Input type: timeseries
Output type: timeseries
Parameters:
par: int
Par (face) value of the bond.
maturity (in years): int
Number of years to maturity.
coupon: float or rosecode
Annual coupon rate in percentage points. (ex. 3.125% -> 3.125)
coupon_frequency: int
Number of coupon periods per year.
:z
Calculates the Z score for a timeseries. A Z-score is based on the average and standard deviation of a dataset.
Input type: timeseries
Output type: map
Parameters:
none
map
:add
Calculates the sum of a column in a map.
Input type: map
Output type: map
Parameters:
column: column
Column name.
:addcolumns
Calculates the sum for each row across columns of a map and stores it in the specified result column name.
Input type: map
Output type: map
Parameters:
columns: column name*
Columns to be added and the new results column name.
:append
Appends a map to another map assuming both maps have identical column names.
Input type: map
Output type: map
Parameters:
map: rosecode
A rosecode of a map.
:averagecolumns
Calculates the average of each row in a map given a set of columns. Cell values must be numeric.
Input type: map
Output type: map
Parameters:
column(s): column name(s)*
Column(s) from the map to be included in the average.
results column name: string
Name of the new column containing the averaged values.
:bucket
Replaces values in a column with values from a bucket map provided.
Input type: map
Output type: map
Parameters:
column_to_bucket : column name
Column from the base map to replace values with buckets.
bucket_map: rosecode
Name of the map containing the buckets.
bucket_map_column_with_bucket: column name
Column from the bucket map
lower_bound_column: column name
upper_bound_column: column name
:cap
Set a cap (upper limit) for one or more column of numbers. Any value greater than the cap is replaced with the cap value.
Input type: map
Output type: map
Parameters:
cap: float
Value to be used as the cap (upper limit).
column(s) [optional] : column name(s), default= none
Column(s) from the map to be capped. If no column is given, caps the entire map.
:columns
Returns a new map with one column containing only the column names of the original map
Input type: map
Output type: map
Parameters:
none
:concatenate
Appends a string or second column value to the end of every cell in a given column.
Input type: map
Output type: map
Parameters:
base column: column name
Column from the map to be used as base for the new column.
append value: string or column name
Value to be appended to the base column value.
results column [optional] : string, default= base column
Name of the new column containing the concatenated values. Default will replace the original base column values with the new results.
:datetoquarter
Converts a column of dates into date-to-quarter format (YYYYQ#). Replaces the original dates in-place.
Input type: map
Output type: map
Parameters:
date column: column name
Name of the date column to be converted into date-to-quarter format (YYYYQ#)
:div
Divide a column by another column in the same map.
Input type: map
Output type: map
Parameters:
column: column
Column name.
:dropcolumns
Drops selected columns from a map
Input type: map
Output type: map
Parameters:
columns: column name*
Columns to be dropped.
:dropduplicates
Drops duplicate values found in specified column(s) and keep the first, last, or none of the duplicates.
Input type: map
Output type: map
Parameters:
columns(s): column name*
Column(s) to drop duplicates from.
instance to keep [optional] : string, default= first
Which instance of duplicate value to keep.
:dropna
Drops rows with empty values and any specified values
Input type: map
Output type: map
Parameters:
value(s) to drop [optional] : string*, default= ""
Value(s) to drop
:eval
Converts columns of rosecodes to their last value.
Input type: map
Output type: map
Parameters:
column: column name*
Column name
:exists
Check if values exists in map or specified columns if provided. Returns one (1) or zero (0) if the value exists or not.
Input type: map
Output type: map
Parameters:
column(s) [optional] : column name(s)*
Column(s) from the map to check. If no column is given, checks the entire map
:filldown
Returns map with missing values filled from top to bottom over given columns
Input type: map
Output type: map
Parameters:
column(s): column name(s)*
Column(s) from the map to be filled down.
:filter
Filter values in map by a column and condition. ex: column1 >= 1
Input type: map
Output type: map
Parameters:
filter condition: string
Filter condition containing a column name, relational operator, and conditional value. Conditional value can be a string, number or another column. Relational operator options include: =, <>, >, <, >=, <=
filter type [optional] : value or column, default= value
How the comparison should be evaluated. Value = compares the every cell in the column to the conditional value. Column = compares every row pair for the two columns using the operator given.
value or boolean [optional] : int, default= 0
How the results will be returned. 0 = returns every row with a match to the conditional value, 1 = returns 1 (true) or 0 (false) for every row based on if it matches the conditional value.
:firstoccurence
Returns the date of the first occurence of a non-zero value for every row in a column of rosecodes.
Input type: map
Output type: map
Parameters:
column: column name
Column of rosecodes to be assessed.
:floor
Set a floor (lower limit) for one or more column of numbers. Any value less than the floor is replaced with the floor value.
Input type: map
Output type: map
Parameters:
floor value: float
Value to be used as the cap (upper limit).
column(s) [optional] : column name(s)*, default= none
Column(s) from the map to be capped. If no column is given, caps the entire map.
:groupby
Group a table by a column and aggregation (ex: sum, mean, max, min...etc) and return a column with that aggregation on it
Input type: map
Output type: map
Parameters:
column to group: column name*
Column(s) to group by (typically contains categorical data)
column to aggregate: column name*
Column(s) to aggregate by (can be numeric or categorial)
aggregation type: string
What calculation to apply to the aggregation column. Options include: count, sum, mean, mad, median, min, max, mode, abs, prod, std, var, sem, skew, kurt, quantile, cumsum, cumprod, cummax, cummin
:insertcolumn
Inserts a new column with specified new column name and values.
Input type: map
Output type: map
Parameters:
new column name: string
Name of the new column header.
new column values: column, string, or int
Value(s) for the new column. Can be an integer, string, or another column from the map (will copy the contents for each row in that column).
:join
Joins two maps on a given column, performs left join by default or specify join type for left, right, outer, or inner joins.
Input type: map
Output type: map
Parameters:
secondary map: rosecode
Name of the map to join with the base map.
column in base map: column name
Name of the column from the base map to perform the join on.
column in secondary map: column name
Name of the column from the seconary map to perform the join on.
join type [optional] : string, default= left
Left: keeps all values from the base map and any matches from the secondary map. Right: keeps all values from the secondary map and any matches from the base map. Outer: keeps all values from both maps. Inner: only keeps values that match in both maps.
:last
Get the last value for each rosecode in a column, returning blank for rows that are not rosecodes.
Input type: map
Output type: map
Parameters:
columns: column*
Column name.
:limit
Limits the number of rows in a map to either a number or by a percentage in decimal form.
Input type: map
Output type: map
Parameters:
limit value: float
Number or percentage of rows to keep in the map.
:logic
Returns the underlying logic of the rosecode.
Input type: map
Output type: map
Parameters:
none
:mean
Calculates the arithmetic average value of a map column given a column name.
Input type: map
Output type: map
Parameters:
column: column name
Column name.
:merge
Merges two maps using an outer join
Input type: map
Output type: map
Parameters:
map: rosecode
Map to be merged into the original map.
:metas
Returns metadata of a rosecode.
Input type: map
Output type: map
Parameters:
none
:mult
Multiply a column in a map by a given value.
Input type: map
Output type: map
Parameters:
column: column name
Column name
value: float
Value for each point in the timeseries to by mulitplied by
:offset
Shift a map by the specified number of rows.
Input type: map
Output type: map
Parameters:
offset amount: int
How many rows to offset the data; can be positive or negative.
:pickcolumns
Return a map with only selected columns
Input type: map
Output type: map
Parameters:
column(s): column*
a list of columns
:pivot
Create a spreadsheet-style pivot table as a map.
Input type: map
Output type: map
Parameters:
values column: column name
Column to perform the aggregation on.
index column(s): column name(s)
Column(s) to use as the index for the pivot
results column: column name
Name of the new column for the aggregation results.
aggregation: string
What calculation to apply to the aggregation column. Options include: mean, std, var, sum, prod, cumsum, cumprod, min, max.
:renamecolumns
Rename the column names of a map given a list of old and new names. Ex: renamecolumns(column=newname)
Input type: map
Output type: map
Parameters:
old_name = new_name: column name = new column name*
List of old column name = new column name
:replace
Replaces all instances of a value with another value (provide only the value and replacement) or replaces every instance of a valuein a column with the value of another column (provide the base column name, value, and replacement column name).
Input type: map
Output type: map
Parameters:
column name or global value: column name or string
Column containing the value or just the value to search all columns.
value or replacement: string
If a column is provided as the first parameter, then this is the value to find. Otherwise, this is the replacement value.
replacement [optional] : string or column, default= none
Only used if a column is provided as the first parameter. Can either being a single value to replace all instances of the placeholder or a column with replacements for rows that match the value.
:replacewithz
Calculates and replaces with the Z score of the given column(s). If no column names are given, acts on all numeric columns.
Input type: map
Output type: map
Parameters:
column(s) [optional] : column name(s)*, default= none
Column(s) to replace with Z-scores.
:rosecodegenerator
Generates a rosecode from a series of selected string columns joined by periods
Input type: map
Output type: map
Parameters:
columns to combine: column name(s)*
List of columns to combine row-wise into rosecodes.
new column name: column name
Name of the new column containing the rosecodes.
:round
Round columns in a map to specified number of decimal places.
Input type: map
Output type: map
Parameters:
columns_to_round: column*
Column in which to round values.
decimals_to_round [optional] : int*
Number of decimals to round to.
:search
Search a key word in a map. Returns all rows that contain the keyword.
Input type: map
Output type: map
Parameters:
keyword: string
The search target.
:sort
Sorts a map on a given column. Options for sort order and to use the last value of all rosecodes in a column.
Input type: map
Output type: map
Parameters:
column: column name
Column to sort by
sort order [optional] : int, default= 1
Order to sort by. 1 = ascending, 0 = descending
last value [optional] : int, default= 0
Option to use the last value of each timeseries if the sort column contains rosecodes. If this option is not set to 1, the default will sort the column of rosecodes alphabetically.
:sum
Calculates the sum across non-string rows in a map
Input type: map
Output type: map
Parameters:
none
:todate
Converts column(s) of strings dates to yyyy-dd-mm date format.
Input type: map
Output type: map
Parameters:
column(s): column name(s)*
Column(s) of dates to be converted.
:transpose
Transposes a map (rotates rows and columns).
Input type: map
Output type: map
Parameters:
new header: column name
Column from the map to be used as the new column headers.
new header: column name
Column values to be used as coumn headers.
:ts
Converts a map into a timeseries given a date column and value column.
Input type: map
Output type: timeseries
Parameters:
date column: column name
Column from the map that contains the dates
value column: column name
Column from the map that contains the values
charting
:areachart
Generates an area chart from a map containing columns for date, value and label (optional).
Input type: map
Output type: chart
Parameters:
x-axis: column name
Column that contains the values (dates) for the x-axis of the chart
y-axis: column name
Column that contains the values for the y-axis of the chart
labels [optional] : column name, default= none
Column that contains the labels for the chart, if none is given, no labels will be displayed.
:barchart
Generates a bar chart from a map
Input type: map
Output type: chart
Parameters:
labels: column name
Column that contains the labels for the chart
values: column name*
Column(s) that contains the values for the chart
:bubblechart
Generates a bubble chart from a map
Input type: map
Output type: chart
Parameters:
labels: column name
Column that contains the labels for the chart
values: column name*
Column(s) that contains the values for the chart
:heatmap
Generates a heatmap from a map
Input type: map
Output type: chart
Parameters:
labels: column name
Column that contains the labels for the chart
values: column name*
Column(s) that contains the values for the chart
:piechart
Generates a pie chart from a map
Input type: map
Output type: chart
Parameters:
labels: column name
Column that contains the labels for the chart
values: column name
Column that contains the labels for the chart
:scatterplot
Generates a scatter plot from a map
Input type: map
Output type: chart
Parameters:
x-axis: column name
Column that contains the values for the x-axis of the chart
y-axis: column name
Column that contains the values for the y-axis of the chart
labels [optional] : column name, default= none
Column that contains the labels for the scatterplot, if none is given, no labels will be displayed.