Per-site results as Explorer.DataFrames.
to_dataframe/2 turns a local ESDA result (Spatex.ESDA.MoranLocal,
Spatex.ESDA.GLocal, and any other result struct whose per-site fields are lists with one
entry per site), a Spatex.Classify result or a Spatex.Region result into a dataframe
with one row per site.
Explorer is an optional dependency: it is only touched when this module is called, through
runtime dispatch, so Spatex compiles and runs without it.
Columns
Every field that is a list with one scalar per site becomes a column named after the field
(is, q, z, lag, p_sim, gs, zs, ...). Fields that are nil (for example
p_sim with permutations: 0), the simulation matrices (sim) and non-per-site fields are
skipped. In addition:
id- the graph node ids, first column, when the result carries them (ids that are not integers or strings are converted withto_string/1/inspect/1).cluster- forSpatex.ESDA.MoranLocalwith ap_sim, the quadrant label fromSpatex.ESDA.MoranLocal.cluster_labels/2.yb- forSpatex.Classify, the class of each observation.labels- for theSpatex.Regionresults (Skater,Ward,RegionKMeans,AZP,MaxP), the region of each area; the only column.nil(areasSpatex.Region.max_p/3dropped) becomes a missing value.
Non-finite floats stay :nan, :infinity and :neg_infinity, which Explorer reads as
float special values.
Options
:crit- significance level for theclustercolumn (default0.05).
Examples
iex> g = Spatex.Graph.from_arrays([0, 1, 1, 2, 2, 3], [1, 0, 2, 1, 3, 2])
iex> m = Spatex.ESDA.moran_local([1, 5, 2, 8], g, permutations: 0)
iex> df = Spatex.Explorer.to_dataframe(m)
iex> Explorer.Series.to_list(df["q"])
[2, 4, 2, 4]
Summary
Functions
Converts a per-site result to an Explorer.DataFrame. See the module documentation.
Functions
Converts a per-site result to an Explorer.DataFrame. See the module documentation.