index
execution_count
cell_type
toolbar
started_at
completed_at
source
loc
metadata
outputs
1
unexecuted
In
[
]
markdown
# wind chime table
![an html transform to look like a wind chime in my yard. each row is a bar that rotates around the z axis so it spins with the slightest wind. ](attachment:5db474ff-aee9-4d3c-944e-5f0835cb6b6d.png )
metadata
3
2
executed
In
[
1
]
code
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 = compose_left ( operator . methodcaller ( "items" ), map ( "-- %s : %s " . __mod__ ), ";" . join , " {} ;" . format )
metadata
2
0 outputs.
Out
[
1
]
3
executed
In
[
2
]
code
%%
< style >
. dataframe {
-- height : 600 px ;
display : block ;
position : relative ;
width : 100 % ;
border : 5 px red solid ;
transform : scaleY ( 1 );
transform - style : preserve - 3 d ;
tbody {
tr {
display : block ;
border : 4 px white solid ;
transform : translateX ( 300 px ) perspective ( 300 px ) rotateY ( calc ( 1 deg * var ( -- index )));
th , td {
}
}
}
}
</ style >
{ % set df = df . reset_index () % }
{ % set groups = [ df ] % }
< table class = dataframe >
< thead >
< tr >< th > index </ th >
{ %- for k in df . columns -% }
< th > {{ k }} </ th >
{ %- endfor -% }
</ tr >
</ 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 >
metadata
45
1 outputs.
Out
[
2
]
index
index
x
y
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
4
unexecuted
In
[
None
]
code
metadata
0
Out
[
None
]