In [1]:
require 'mikon'


Out[1]:
Out[1]:
true

In [3]:
arr1 = ([0]*100).map{rand-0.5}.reduce([0.0]){|memo, val| memo.push(memo.last + val); memo}
arr2 = ([0]*100).map{rand-0.5}.reduce([0.0]){|memo, val| memo.push(memo.last + val); memo}
df = Mikon::DataFrame.new({a: arr1, b: arr2})


Out[3]:
ab
00.00.0
1-0.37437015194946410.08695749145080711
2-0.75062502833107210.20895501522938087
3-0.73057863276822520.4365217515672837
4-0.343551280372933140.41172077368829163
5-0.77829582907134280.624233177175703
6-0.42555918231990920.9205294551215266
7-0.135117704484795320.6374088589843501
8-0.126223721493049720.8183366213796216
9-0.51798257842126330.8813996471860409
10-0.95248632089962851.24317735044235
11-0.81952325074099351.4306392539428965
12-0.53484942464655091.2490969685357804
13-0.421409964918356031.2066484814546343
14-0.75414244077281280.8133830872676959
15-0.413340025369700160.5646023591277001
16-0.7124423729551940.4587654582991706
17-1.14462281899941720.799565558439286
18-1.0376546853459531.1524036560935964
19-1.44355277469943341.2316371707520215
20-1.4005030830637391.4618919034611357
21-0.98203705897855151.2790020887802638
22-0.96802623980263881.593027750210224
23-0.5129456700482991.8897029157850205
24-0.87071759273712151.8683674116728959
25-0.60794105535058182.30130114159547
26-0.38077253321525461.907571159117499
27-0.45535156592113772.2128964671613733
28-0.89085700184273662.402528029862967
29-1.37591545769455032.5711758591478295
30-1.55812062485379242.2727791315919923
31-1.21423674745143422.5120999920396505
32-1.16048971937182892.4974766648227025
33-1.60084532984878412.520334121956631
34-1.19452792836911152.781010048602015
35-1.53909750713079462.8819831761124783
36-1.21236489306995223.3801607249116095
37-0.81555012319235243.668438340178123
38-0.83598295932220213.519879347449894
39-0.95096915530476443.5486396225844947
40-0.55437784174646143.057484391616062
41-0.22210201832265423.238472540872777
42-0.180177929918765133.30490860249322
43-0.58349032762753883.3666226758446527
44-1.0525417548604563.7650501174953
45-1.44550560909444314.227532919056422
46-1.18936361696040124.567357916328972
47-0.91949452958581154.45781976293442
48-0.45659545654072644.9294281069741395
49-0.90790614121982254.978676168435798
50-0.45911772823313784.6885799693058745
.........
1000.9034854499748763.076741620131531

In [9]:
df.plot


Out[9]:

In [5]:
df.plot(type: :box)


Out[5]:

In [11]:
df.plot(type: :scatter, x: :a, y: :b, fill_by: :b, color: :seq)


Out[11]:

In [12]:
plot = df[:a].plot
plot.yrange([0, 25])
plot


Out[12]:

In [13]:
df[:a].plot(type: :line)


Out[13]:

In [9]:
df = Mikon::DataFrame.new([{a: 1, b: 5}, {a: 2, b: 2}, {a: 3, b: 4}])


Out[9]:
ab
015
122
234

In [12]:
df[:a].to_a


Out[12]:
[1, 2, 3]

In [5]:
df.sort_by(false){a}


Out[5]:
ab
034
229
115

In [6]:
df[:a]


Out[6]:
a
03
11
22

In [7]:
df.map{a}.to_darr.sorted_indices


Out[7]:
[1, 2, 0]

In [8]:
df = Mikon::DataFrame.new([[0, 1, 2], [0, 1, 2]])


Out[8]:
01
000
111
222

In [9]:
df = Mikon::DataFrame.new([[0, 1, 2], [0, 1, 2]], labels: [:a, :b], index: [1,2,3])


Out[9]:
ab
100
211
322

In [10]:
require 'nyaplot'


Out[10]:
false

In [11]:
plot = Nyaplot::Plot.new
plot.add_with_df(df, :scatter, :a, :b)
plot


Out[11]: