non-numerical dataframes
dataframes will be challenging for folks with dyscalculia. the wai-adapt has started writing guidance for concepts like this, but dataframes are likely out of scope.
this notebook sketches an approach towards subtle visual identificaition of a table value in a distribution. before making this i realized that there is no way to explore a table of numbers with dyscalculia. i imagine i'll be thinking more about the visual, audible, and tactile aspects of numeric information.
we'll want a systematic approach where we explore how the dimensions of line, tone/weight, and, lastly, color can present numerical concepts using visual gestalts.
an interesting outcome of this approach is that scrolling activates an animation of the values. it reverses back into albers assertion that notice color in motion and when it is changing. simple concepts like this have significant potential for activiting ones participation in exploring data.
%%
df = pipe ( numpy . linspace ( 0 , 360 , 101 ), pandas . Index ) . rename ( "index" ) . to_series () . mul ( numpy . pi / 180 ) . apply ( lambda x : pandas . Series ( dict ( x = numpy . cos ( x ), y = numpy . sin ( x ))))
style_attributes = lambda extra = "" : compose_left ( operator . methodcaller ( "items" ), map ( F "--%s { extra } : %s" . __mod__ ), ";" . join , " {} ;" . format )
{ % set df = df . reset_index () % }
{ % set summary = df . describe () % }
{ % set groups = [ df , df . sample ( 20 )] % }
< style >
. dataframe {
-- height : 600 px ;
display : block ;
position : relative ;
width : 100 % ;
border : 5 px red solid ;
{ %- for col in df . columns -% }
-- d {{ col }}: calc ( var ( -- {{ col }} - max ) - var ( -- {{ col }} - min ));
{ %- endfor -% }
-- dx : calc ( var ( -- x - max ) - var ( -- x - min ));
-- dy : calc ( var ( -- y - max ) - var ( -- y - min ));
tbody , thead {
tr {
border : 4 px white solid ;
position : relative ;
td {
{ %- for col in df . columns -% }
& : nth - of - type ({{ loop . index }}) {
-- rel : calc (( var ( -- {{ col }}) - var ( -- {{ col }} - min )) / var ( -- d {{ col }}));
}
{ %- endfor -% }
background : linear - gradient ( 90 deg ,
rgba ( 0 , 0 , 0 , 0 ) calc ( 100 % * var ( -- rel ) - .25 rem ),
rgba ( 128 , 128 , 128 , .5 ) calc ( 100 % * var ( -- rel )),
rgba ( 0 , 0 , 0 , 0 ) calc ( 100 % * var ( -- rel ) + .25 rem )
);
}
}
}
}
</ style >
%%
< table class = "dataframe" min "].pipe(style_attributes(" - min "))}}{{summary.loc[" max "].pipe(style_attributes(" - max "))}}" = "" style = "{{summary.loc[" >
< caption > a table of sin and cosine data with visual representations in each cell .</ caption >
< thead >
< tr >
< th > index </ th >
{ %- for k in df . columns -% }
< th > {{ k }} </ th >
{ %- endfor -% }
</ tr >
{ %- for i , row in summary . iterrows () -% }
< tr style = "{{style_attributes()(row)}}" >
< th scope = "row" > {{ row . name }} </ th >
{ %- for k in df . columns -% }
< td > {{ row . loc [ k ]}} </ td >
{ %- endfor -% }
</ tr >
{ %- endfor -% }
</ thead >
{ %- for g in groups -% }
< tbody >
{ %- for i , row in g . iterrows () -% }
< tr style = "{{style_attributes()(row)}}" >
< th > {{ loop . index }} </ th >
{ %- for k in df . columns -% }
< td > {{ row . loc [ k ]}} </ td >
{ %- endfor -% }
</ tr >
{ %- endfor -% }
</ tbody >
{ %- endfor -% }
</ table >
df = pipe(numpy.linspace(0, 360, 101), pandas.Index).rename("index").to_series().mul(numpy.pi/180).apply(lambda x: pandas.Series(dict(x=numpy.cos(x), y=numpy.sin(x))))
style_attributes = lambda extra="": compose_left(operator.methodcaller("items"), map(F"--%s{extra}: %s".__mod__), ";".join, "{};".format)
%%
a table of sin and cosine data with visual representations in each cell.
index index x y
count 101.0 101.0 101.0
mean 180.0 0.009900990099009927 5.681783374570121e-18
std 105.48061433268201 0.7140735186932855 0.7071067811865475
min 0.0 -1.0 -1.0
25% 90.0 -0.6845471059286887 -0.6845471059286887
50% 180.0 6.123233995736766e-17 0.0
75% 270.0 0.7289686274214116 0.6845471059286887
max 360.0 1.0 1.0
1 0.0 1.0 0.0
2 3.6 0.9980267284282716 0.06279051952931337
3 7.2 0.9921147013144779 0.12533323356430426
4 10.8 0.9822872507286887 0.18738131458572463
5 14.4 0.9685831611286311 0.2486898871648548
6 18.0 0.9510565162951535 0.3090169943749474
7 21.6 0.9297764858882513 0.368124552684678
8 25.2 0.9048270524660196 0.42577929156507266
9 28.8 0.8763066800438636 0.4817536741017153
10 32.4 0.8443279255020151 0.5358267949789967
11 36.0 0.8090169943749475 0.5877852522924731
12 39.6 0.7705132427757891 0.6374239897486897
13 43.2 0.7289686274214116 0.6845471059286887
14 46.800000000000004 0.6845471059286886 0.7289686274214116
15 50.4 0.6374239897486897 0.7705132427757893
16 54.0 0.5877852522924731 0.8090169943749475
17 57.6 0.5358267949789965 0.8443279255020151
18 61.2 0.48175367410171516 0.8763066800438637
19 64.8 0.42577929156507266 0.9048270524660196
20 68.4 0.36812455268467786 0.9297764858882515
21 72.0 0.30901699437494745 0.9510565162951535
22 75.60000000000001 0.24868988716485474 0.9685831611286311
23 79.2 0.18738131458572452 0.9822872507286887
24 82.8 0.12533323356430426 0.9921147013144779
25 86.4 0.0627905195293133 0.9980267284282716
26 90.0 6.123233995736766e-17 1.0
27 93.60000000000001 -0.0627905195293134 0.9980267284282716
28 97.2 -0.12533323356430437 0.9921147013144778
29 100.8 -0.1873813145857246 0.9822872507286887
30 104.4 -0.24868988716485485 0.9685831611286311
31 108.0 -0.30901699437494734 0.9510565162951536
32 111.60000000000001 -0.368124552684678 0.9297764858882513
33 115.2 -0.4257792915650727 0.9048270524660195
34 118.8 -0.48175367410171505 0.8763066800438637
35 122.4 -0.5358267949789969 0.844327925502015
36 126.0 -0.587785252292473 0.8090169943749475
37 129.6 -0.6374239897486897 0.7705132427757893
38 133.20000000000002 -0.6845471059286887 0.7289686274214114
39 136.8 -0.7289686274214117 0.6845471059286885
40 140.4 -0.7705132427757894 0.6374239897486895
41 144.0 -0.8090169943749473 0.5877852522924732
42 147.6 -0.8443279255020151 0.5358267949789967
43 151.20000000000002 -0.8763066800438636 0.4817536741017152
44 154.8 -0.9048270524660196 0.4257792915650725
45 158.4 -0.9297764858882515 0.36812455268467775
46 162.0 -0.9510565162951535 0.3090169943749475
47 165.6 -0.9685831611286311 0.24868988716485482
48 169.20000000000002 -0.9822872507286887 0.18738131458572457
49 172.8 -0.9921147013144779 0.1253332335643041
50 176.4 -0.9980267284282716 0.06279051952931314
51 180.0 -1.0 1.2246467991473532e-16
52 183.6 -0.9980267284282716 -0.06279051952931335
53 187.20000000000002 -0.9921147013144779 -0.12533323356430429
54 190.8 -0.9822872507286886 -0.18738131458572477
55 194.4 -0.9685831611286311 -0.24868988716485502
56 198.0 -0.9510565162951536 -0.3090169943749473
57 201.6 -0.9297764858882515 -0.3681245526846779
58 205.20000000000002 -0.9048270524660195 -0.42577929156507266
59 208.8 -0.8763066800438635 -0.4817536741017154
60 212.4 -0.844327925502015 -0.5358267949789968
61 216.0 -0.8090169943749476 -0.587785252292473
62 219.6 -0.7705132427757893 -0.6374239897486896
63 223.20000000000002 -0.7289686274214116 -0.6845471059286887
64 226.8 -0.6845471059286886 -0.7289686274214116
65 230.4 -0.6374239897486895 -0.7705132427757894
66 234.0 -0.5877852522924732 -0.8090169943749473
67 237.6 -0.5358267949789971 -0.8443279255020149
68 241.20000000000002 -0.48175367410171527 -0.8763066800438636
69 244.8 -0.42577929156507216 -0.9048270524660198
70 248.4 -0.3681245526846778 -0.9297764858882515
71 252.0 -0.30901699437494756 -0.9510565162951535
72 255.6 -0.2486898871648553 -0.968583161128631
73 259.2 -0.18738131458572463 -0.9822872507286887
74 262.8 -0.12533323356430373 -0.9921147013144779
75 266.40000000000003 -0.06279051952931321 -0.9980267284282716
76 270.0 -1.8369701987210297e-16 -1.0
77 273.6 0.06279051952931372 -0.9980267284282716
78 277.2 0.12533323356430423 -0.9921147013144779
79 280.8 0.18738131458572513 -0.9822872507286886
80 284.40000000000003 0.24868988716485493 -0.9685831611286311
81 288.0 0.30901699437494723 -0.9510565162951536
82 291.6 0.36812455268467825 -0.9297764858882512
83 295.2 0.4257792915650726 -0.9048270524660196
84 298.8 0.4817536741017157 -0.8763066800438634
85 302.40000000000003 0.5358267949789968 -0.844327925502015
86 306.0 0.5877852522924729 -0.8090169943749476
87 309.6 0.63742398974869 -0.770513242775789
88 313.2 0.6845471059286886 -0.7289686274214116
89 316.8 0.7289686274214119 -0.6845471059286883
90 320.40000000000003 0.7705132427757894 -0.6374239897486896
91 324.0 0.8090169943749473 -0.5877852522924734
92 327.6 0.8443279255020153 -0.5358267949789963
93 331.2 0.8763066800438636 -0.4817536741017153
94 334.8 0.9048270524660197 -0.4257792915650722
95 338.40000000000003 0.9297764858882515 -0.36812455268467786
96 342.0 0.9510565162951535 -0.3090169943749476
97 345.6 0.9685831611286312 -0.2486898871648545
98 349.2 0.9822872507286887 -0.18738131458572468
99 352.8 0.9921147013144779 -0.1253332335643038
100 356.40000000000003 0.9980267284282716 -0.06279051952931326
101 360.0 1.0 -2.4492935982947064e-16
1 172.8 -0.9921147013144779 0.1253332335643041
2 356.40000000000003 0.9980267284282716 -0.06279051952931326
3 248.4 -0.3681245526846778 -0.9297764858882515
4 140.4 -0.7705132427757894 0.6374239897486895
5 187.20000000000002 -0.9921147013144779 -0.12533323356430429
6 36.0 0.8090169943749475 0.5877852522924731
7 320.40000000000003 0.7705132427757894 -0.6374239897486896
8 72.0 0.30901699437494745 0.9510565162951535
9 64.8 0.42577929156507266 0.9048270524660196
10 162.0 -0.9510565162951535 0.3090169943749475
11 219.6 -0.7705132427757893 -0.6374239897486896
12 111.60000000000001 -0.368124552684678 0.9297764858882513
13 133.20000000000002 -0.6845471059286887 0.7289686274214114
14 50.4 0.6374239897486897 0.7705132427757893
15 226.8 -0.6845471059286886 -0.7289686274214116
16 338.40000000000003 0.9297764858882515 -0.36812455268467786
17 115.2 -0.4257792915650727 0.9048270524660195
18 295.2 0.4257792915650726 -0.9048270524660196
19 201.6 -0.9297764858882515 -0.3681245526846779
20 284.40000000000003 0.24868988716485493 -0.9685831611286311