Skip to content

Instantly share code, notes, and snippets.

@mdengler
mdengler / slice panel4d
Created June 10, 2016 03:25
panel4d iloc and slices?
>>> p4 = pd.Panel4D({i: pd.Panel({j: pd.DataFrame(range(10)) for j in range(10)}) for i in range(10)})
>>> p4.iloc[:,:,0]
<class 'pandas.core.panel.Panel'>
Dimensions: 10 (items) x 10 (major_axis) x 1 (minor_axis)
Items axis: 0 to 9
Major_axis axis: 0 to 9
Minor_axis axis: 0 to 0
>>> p4.iloc[slice(None), slice(None), slice(0)]
<class 'pandas.core.panelnd.Panel4D'>
Dimensions: 10 (labels) x 10 (items) x 0 (major_axis) x 1 (minor_axis)
#!/usr/bin/env python
import json
import random
filename = "test.json"
x = [{"ID": i,
"xxx": "".join(["f"] * random.randint(1, 20)),
"yyy": "".join(["f"] * random.randint(1, 20))}
for i in range(20)]
@mdengler
mdengler / README.md
Last active October 11, 2017 02:32
SugarLabs clock device patch and mockups