qis.LegendStats¶
- class qis.LegendStats(*values)[source]¶
Bases:
Enumwhich summary statistics the legend prints beside each series name.
The members are compositional and the name reads left to right in the order the statistics appear in the legend, so
AVG_STD_LASTprints the mean, the standard deviation and the final value in that order. Rather than restate twenty-nine names, the vocabulary:AVGmean,STDstandard deviation withddof=1,MEDIANmedian,MADmedian absolute deviation scaled to be comparable with a standard deviation,SKEWthe biased standardized third moment,KURTbiased excess kurtosis,TSTATmean over standard error,TOTALthe sum,FIRSTandLASTthe endpoints,MINandMAXthe extremes. After any modifier’s sample selection,STDis undefined when fewer than two observations remain;SKEWandKURTare undefined for an exact finite constant. Finite samples are translated before sample standard deviation is evaluated, and eligible finite varying samples are translated before standardized moments are evaluated, preserving their results when the spread is very small relative to the level.Endpoint selection is mode-specific. The direct endpoint modes
LAST,AVG_LAST, andAVG_STD_LASTuse the value at the final index. ExplicitNONNANmodes use the final observed value. Other compositeFIRST/LASTmodes first drop missing observations and select both endpoints from that same sample, soFIRSTmeans the first selected observation.NONZEROcomposites additionally remove exact zeros before selecting their endpoints.Five modifiers change what the statistics are computed on or displayed beside them:
NONNANnames final-observed selection explicitly.NONZEROexcludes zeros, for a series where zero means “no position” rather than “a return of zero”; its statistics are undefined when no observations remain.MISSINGreports the percentage of NaN observations after the first observed value, whileZEROreports the percentage whose absolute value is below the near-zero cutoff over the same window. An all-missing history has 100% missing coverage and an undefined zero percentage.SCOREappends the percentile rank of the last value within its own selected history.NONEprints the column name alone. Data-valued summaries such as the mean and standard deviation follow the plotting function’svar_format; when it isNone, these summaries use their native scalar text. T-statistics, skewness and kurtosis keep separate two-decimal formats, while scores and missing/zero ratios keep percentage formats. A percentage-formatted mean therefore does not turn its dimensionless t-statistic into a percentage. A missing indexed endpoint uses the configured numeric missing display regardless of whether the input stores it asnp.nanorpd.NA. The enum selects the statistics together with their mode-specific display conventions.A member documented here is computed in
get_legend_lines, which is the single place the legend text is built for every plot in the package.- __init__(*args, **kwds)¶
Attributes
- NONE = 1¶
- LAST = 2¶
- AVG = 3¶
- AVG_LAST = 4¶
- AVG_STD = 5¶
- AVG_STD_SKEW_KURT = 6¶
- AVG_STD_LAST = 7¶
- AVG_NONNAN_LAST = 8¶
- NONZERO_AVG_LAST = 81¶
- NONZERO_AVG_STD_LAST = 82¶
- MEDIAN_NONNAN_LAST = 9¶
- AVG_MEDIAN_STD_NONNAN_LAST = 10¶
- AVG_LAST_SCORE = 11¶
- AVG_STD_LAST_SCORE = 12¶
- FIRST_LAST = 13¶
- FIRST_LAST_NON_ZERO = 14¶
- FIRST_AVG_LAST = 15¶
- FIRST_MEDIAN_LAST = 16¶
- FIRST_AVG_LAST_SHORT = 17¶
- AVG_STD_MISSING_ZERO = 18¶
- MISSING_AVG_LAST = 19¶
- TOTAL = 20¶
- MEDIAN = 21¶
- MEDIAN_MAD = 22¶
- TSTAT = 23¶
- AVG_STD_TSTAT = 24¶
- LAST_NONNAN = 25¶
- AVG_MIN_MAX_LAST = 26¶
- FIRST_MIN_MAX_LAST = 27¶