index
execution_count
cell_type
toolbar
started_at
completed_at
source
loc
metadata
outputs
1
unexecuted
In
[
]
markdown
# improved output semantic for python objects
when we provide the right semantics to the outputs we increase the tactile representation on assistive techonology. these improvements make it easier for screen reader users to surface lists, tables, and links created from python.
we use the `itemscope` and `itemtype` properties as the proper semantic attributes to provide type information. these types extend to css selectors that can tailor specific type representations.
metadata
5
when we provide the right semantics to the outputs we increase the tactile representation on assistive techonology. these improvements make it easier for screen reader users to surface lists, tables, and links created from python.
we use the
itemscope
and
itemtype
properties as the proper semantic attributes to provide type information. these types extend to css selectors that can tailor specific type representations.
2
unexecuted
In
[
]
markdown
![list of lists, sets, tuples found on this page by the orca screen reader ](attachment:433375f5-8127-4e69-9797-e3dd61140691.png )
![list of tables found on this page by the orca screen reader ](attachment:4e8c0c77-3589-41a5-aae8-03796470919b.png )
metadata
2
3
unexecuted
In
[
]
markdown
itemscope indicates that representation was generated for known type
metadata
1
itemscope indicates that representation was generated for known type
4
executed
In
[
1
]
code
import nbconvert_a11y.tables
from nbconvert_a11y.outputs import repr_html , repr_semantic
import pandas
% reload_ext nbconvert_a11y . tables
% reload_ext nbconvert_a11y . outputs
metadata
5
1 outputs.
Out
[
1
]
5
unexecuted
In
[
]
markdown
comparing the standard dict repr with the semantic repr
metadata
1
comparing the standard dict repr with the semantic repr
6
executed
In
[
2
]
code
data = { 'a' : 1 , 'b' : 'abc' , 'd' : True , 'e' : False }
data [ "f" ] = data
print ( repr ( data ))
data
metadata
4
2 outputs.
Out
[
2
]
7
unexecuted
In
[
]
markdown
comparing the standard None repr with the semantic repr
metadata
1
comparing the standard None repr with the semantic repr
8
executed
In
[
3
]
code
print ( repr ( None ))
display ( None )
metadata
2
2 outputs.
Out
[
3
]
9
unexecuted
In
[
]
markdown
comparing the standard false repr with the semantic repr
metadata
1
comparing the standard false repr with the semantic repr
10
executed
In
[
4
]
code
metadata
2
2 outputs.
Out
[
4
]
11
unexecuted
In
[
]
markdown
comparing the standard true repr with the semantic repr
metadata
1
comparing the standard true repr with the semantic repr
12
executed
In
[
5
]
code
metadata
2
2 outputs.
Out
[
5
]
13
unexecuted
In
[
]
markdown
comparing the standard int repr with the semantic repr
metadata
1
comparing the standard int repr with the semantic repr
14
executed
In
[
6
]
code
metadata
2
2 outputs.
Out
[
6
]
15
unexecuted
In
[
]
markdown
comparing the standard float repr with the semantic repr
metadata
1
comparing the standard float repr with the semantic repr
16
executed
In
[
7
]
code
print ( repr ( x := 3.14159 ))
x
metadata
2
2 outputs.
Out
[
7
]
17
unexecuted
In
[
]
markdown
comparing the standard list repr with the semantic repr
metadata
1
comparing the standard list repr with the semantic repr
18
executed
In
[
8
]
code
print ( repr ( x := [ 1 , 2 , 3 ,]))
x
metadata
2
2 outputs.
Out
[
8
]
19
unexecuted
In
[
]
markdown
comparing the standard tuple repr with the semantic repr
metadata
1
comparing the standard tuple repr with the semantic repr
20
executed
In
[
9
]
code
print ( repr ( x := ( 1 , 2 , 3 ,)))
x
metadata
2
2 outputs.
Out
[
9
]
21
unexecuted
In
[
]
markdown
metadata
0
22
executed
In
[
10
]
code
print ( repr ( x := { 1 , 2 , 3 ,}))
x
metadata
2
2 outputs.
Out
[
10
]
23
unexecuted
In
[
]
markdown
comparing the standard dict repr with the semantic repr with recursion
metadata
1
comparing the standard dict repr with the semantic repr with recursion
24
executed
In
[
11
]
code
x = dict ( a = 1 , b = "abc" , c = True )
x . update ( z = x )
print ( repr ( x ))
x
metadata
4
2 outputs.
Out
[
11
]
25
executed
In
[
12
]
code
metadata
1
0 outputs.
Out
[
12
]
26
unexecuted
In
[
]
markdown
comparing the standard dataframe repr with the semantic repr
metadata
1
comparing the standard dataframe repr with the semantic repr
27
executed
In
[
13
]
code
df = pandas . DataFrame ( range ( x , x + 10 ) for x in range ( 10 ))
display ({ "text/html" : df . _repr_html_ ()}, raw = True )
df
metadata
3
2 outputs.
Out
[
13
]
0
1
2
3
4
5
6
7
8
9
0
0
1
2
3
4
5
6
7
8
9
1
1
2
3
4
5
6
7
8
9
10
2
2
3
4
5
6
7
8
9
10
11
3
3
4
5
6
7
8
9
10
11
12
4
4
5
6
7
8
9
10
11
12
13
5
5
6
7
8
9
10
11
12
13
14
6
6
7
8
9
10
11
12
13
14
15
7
7
8
9
10
11
12
13
14
15
16
8
8
9
10
11
12
13
14
15
16
17
9
9
10
11
12
13
14
15
16
17
18
rows
10
columns
10
indexes
rows
1
columns
1
index
0
1
2
3
4
5
6
7
8
9
0
0
1
2
3
4
5
6
7
8
9
1
1
2
3
4
5
6
7
8
9
10
2
2
3
4
5
6
7
8
9
10
11
3
3
4
5
6
7
8
9
10
11
12
4
4
5
6
7
8
9
10
11
12
13
5
5
6
7
8
9
10
11
12
13
14
6
6
7
8
9
10
11
12
13
14
15
7
7
8
9
10
11
12
13
14
15
16
8
8
9
10
11
12
13
14
15
16
17
9
9
10
11
12
13
14
15
16
17
18
28
unexecuted
In
[
]
markdown
comparing the standard ndarray repr with the semantic repr
metadata
1
comparing the standard ndarray repr with the semantic repr
29
executed
In
[
14
]
code
print ( repr ( df . values ))
df . values
metadata
2
2 outputs.
Out
[
14
]
array([[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
[ 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
[ 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
[ 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
[ 5, 6, 7, 8, 9, 10, 11, 12, 13, 14],
[ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
[ 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
[ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17],
[ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18]])
rows
10
columns
10
indexes
rows
0
columns
0
0
1
2
3
4
5
6
7
8
9
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
11
3
4
5
6
7
8
9
10
11
12
4
5
6
7
8
9
10
11
12
13
5
6
7
8
9
10
11
12
13
14
6
7
8
9
10
11
12
13
14
15
7
8
9
10
11
12
13
14
15
16
8
9
10
11
12
13
14
15
16
17
9
10
11
12
13
14
15
16
17
18
30
unexecuted
In
[
]
markdown
customize table size through pandas options
metadata
1
customize table size through pandas options
31
executed
In
[
15
]
code
df = pandas . DataFrame ( range ( x , x + 100 ) for x in range ( 200 ))
with pandas . option_context ( "display.max_columns" , 4 , "display.max_rows" , 4 ):
display ( df )
metadata
3
1 outputs.
Out
[
15
]
rows
200
columns
100
indexes
rows
1
columns
1
index
0
1
hidden
98
99
0
0
1
hidden
98
99
1
1
2
hidden
99
100
hidden
hidden
hidden
hidden
hidden
hidden
198
198
199
hidden
296
297
199
199
200
hidden
297
298
32
unexecuted
In
[
]
markdown
custom ndarray size with pandas options
metadata
1
custom ndarray size with pandas options
33
executed
In
[
16
]
code
with pandas . option_context ( "display.max_columns" , 4 , "display.max_rows" , 4 ):
display ( df . values )
metadata
2
1 outputs.
Out
[
16
]
rows
200
columns
100
indexes
rows
0
columns
0
0
1
hidden
98
99
1
2
hidden
99
100
hidden
hidden
hidden
hidden
hidden
198
199
hidden
296
297
199
200
hidden
297
298