Skip to content

Commit

Permalink
#5 finished "Histogramming"
Browse files Browse the repository at this point in the history
  • Loading branch information
kozo2 authored Aug 5, 2016
1 parent 1c19dff commit bfbab5b
Showing 1 changed file with 176 additions and 0 deletions.
176 changes: 176 additions & 0 deletions 10-Minutes-to-daru.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,182 @@
"df.where(df.A.gt(0.1))"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Operations"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Stats"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Performing a descriptive statistic"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<table><tr><th colspan=\"2\">Daru::Vector:70271743627320 size: 4</th></tr><tr><th> </th><th>mean</th></tr><tr><td>A</td><td>0.31512529065443395</td></tr><tr><td>B</td><td>0.27841784270495157</td></tr><tr><td>C</td><td>0.4625499649060813</td></tr><tr><td>D</td><td>0.4179949971692356</td></tr></table>"
],
"text/plain": [
"\n",
"#<Daru::Vector:70271743627320 @name = mean @metadata = {} @size = 4 >\n",
" mean\n",
" A 0.31512529065443395\n",
" B 0.27841784270495157\n",
" C 0.4625499649060813\n",
" D 0.4179949971692356\n"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.mean"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Same operation on the other axis"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<table><tr><th colspan=\"2\">Daru::Vector:70271742756420 size: 6</th></tr><tr><th> </th><th>mean</th></tr><tr><td>2013-01-01T00:00:00+00:00</td><td>0.479349875514806</td></tr><tr><td>2013-01-02T00:00:00+00:00</td><td>0.47051457350211223</td></tr><tr><td>2013-01-03T00:00:00+00:00</td><td>0.5430734609841852</td></tr><tr><td>2013-01-04T00:00:00+00:00</td><td>0.12549099883118234</td></tr><tr><td>2013-01-05T00:00:00+00:00</td><td>0.41477530974946974</td></tr><tr><td>2013-01-06T00:00:00+00:00</td><td>0.177927924570298</td></tr></table>"
],
"text/plain": [
"\n",
"#<Daru::Vector:70271742756420 @name = mean @metadata = {} @size = 6 >\n",
" mean\n",
"2013-01-01T00:00:00+ 0.479349875514806\n",
"2013-01-02T00:00:00+ 0.47051457350211223\n",
"2013-01-03T00:00:00+ 0.5430734609841852\n",
"2013-01-04T00:00:00+ 0.12549099883118234\n",
"2013-01-05T00:00:00+ 0.41477530974946974\n",
"2013-01-06T00:00:00+ 0.177927924570298\n"
]
},
"execution_count": 55,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.transpose.mean"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Apply"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Histogramming"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<table><tr><th colspan=\"2\">Daru::Vector:70271742726080 size: 10</th></tr><tr><th> </th><th>nil</th></tr><tr><td>0</td><td>1</td></tr><tr><td>1</td><td>1</td></tr><tr><td>2</td><td>4</td></tr><tr><td>3</td><td>2</td></tr><tr><td>4</td><td>4</td></tr><tr><td>5</td><td>0</td></tr><tr><td>6</td><td>5</td></tr><tr><td>7</td><td>2</td></tr><tr><td>8</td><td>6</td></tr><tr><td>9</td><td>6</td></tr></table>"
],
"text/plain": [
"\n",
"#<Daru::Vector:70271742726080 @name = nil @metadata = {} @size = 10 >\n",
" nil\n",
" 0 1\n",
" 1 1\n",
" 2 4\n",
" 3 2\n",
" 4 4\n",
" 5 0\n",
" 6 5\n",
" 7 2\n",
" 8 6\n",
" 9 6\n"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = Daru::Vector.new_with_size(10){r=rand(7)}"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<table><tr><th colspan=\"2\">Daru::Vector:70271718946100 size: 6</th></tr><tr><th> </th><th>nil</th></tr><tr><td>1</td><td>2</td></tr><tr><td>4</td><td>2</td></tr><tr><td>2</td><td>2</td></tr><tr><td>0</td><td>1</td></tr><tr><td>5</td><td>1</td></tr><tr><td>6</td><td>2</td></tr></table>"
],
"text/plain": [
"\n",
"#<Daru::Vector:70271718946100 @name = nil @metadata = {} @size = 6 >\n",
" nil\n",
" 1 2\n",
" 4 2\n",
" 2 2\n",
" 0 1\n",
" 5 1\n",
" 6 2\n"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.value_counts"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand Down

0 comments on commit bfbab5b

Please sign in to comment.