there is an interesting outcome when table cells have access to their --ratio in the distribution available in css. these values make it possible to use visual forms to identify colors. it is potentially an axis of design to experiment to design for low numeracy.
%%{{table._repr_html_()}}gists=(await("https://api.github.com/users/tonyfast/gists?page="+pandas.RangeIndex(1,3).astype(str)).http.get()).explode().series().set_index("id")gists.index.name="gist_id"we're going to quickly make a table of my gist from github.files=gists.join(gists.files.apply(dict.values).apply(list).explode().series())unravelallthegistsineachgistpayload.time=files.columns[files.columns.str.endswith("_at")].tolist()files[time]=files[time].apply(pandas.to_datetime,axis=1)files=files.assign(timespan=files.updated_at-files.created_at)converttimestotheirpropertypesandsubstractthemsooutdataframecontainsintegers,datetimes,andtimedeltas,typeswithnumericalrepresentations.files[cat]=files[cat:="language type".split()].astype("category")df=files[time+"timespan filename description language type size".split()]nowaregoingtoaddafewlinesof`css`thatusesthe`--ratio`variablesineachnumericalcelltoproducevisualrepresentationofthecellvalueinthelargerdistribution.itisreallyinterestinghowwestarttocreatethecellborderformwhenwedothis.ataglancewecanvisuallyobserverelativepositionsofvaluesinacolumn.further,scrollingcreatesreallyinterestingmovementthatprovidesusercontrolledanimation.display\
```csstd{--marker-width:.2ch;background:linear-gradient(90deg,rgba(255,0,0,0)0%calc(var(--ratio)*100%-var(--marker-width)),rgba(255,0,0,1)calc(var(--ratio)*100%-var(--marker-width))calc(var(--ratio)*100%+var(--marker-width)),rgba(255,0,0,0)calc(var(--ratio)*100%+var(--marker-width))100%),linear-gradient(0deg,rgba(255,0,0,0)0%calc(var(--ratio)*100%-var(--marker-width)),rgba(255,0,0,1)calc(var(--ratio)*100%-var(--marker-width))calc(var(--ratio)*100%+var(--marker-width)),rgba(255,0,0,0)calc(var(--ratio)*100%+var(--marker-width))100%);}```notebooks=(awaitfiles[files.language.eq("Jupyter Notebook")].raw_url.http.get()).apply(json.loads).series()readthe`notebooks`andseparateoutthecells,outputs,anddisplayobjects.cells=notebooks.cells.enumerate("cell").series()outputs=cells.outputs[cells.outputs.fillna("").astype(bool)].enumerate("display").series()display_data=outputs['data'].dropna().series()df=(df.join(cells.groupby("gist_id").id.count().rename("cells")).join(outputs.groupby("gist_id")["data"].count().rename("outputs")))importnbconvert_a11y.tabletable=df.sort_values("created_at",ascending=False).table(id="gist")
convert times to their proper types and substract them so out dataframe
contains integers, datetimes, and timedeltas, types with numerical representations.
files[cat] = files[cat := "language type".split()].astype("category")
df = files[time + "timespan filename description language type size".split()]
now are going to add a few lines of css that uses the --ratio variables in each numerical cell
to produce visual representation of the cell value in the larger distribution.
it is really interesting how we start to create the cell border form when we do this.
at a glance we can visually observe relative positions of values in a column.
further, scrolling creates really interesting movement that provides user controlled animation.
i added aria-sort annotations to the table and thought some css would give visual representation of the sortedness.
add much context and information will facilitate an accessible experience dyscalculia.