Skip to content

Commit

Permalink
update to DataFrames 0.11.7
Browse files Browse the repository at this point in the history
  • Loading branch information
bkamins committed Jul 25, 2018
1 parent aa7a4ba commit 1335010
Show file tree
Hide file tree
Showing 8 changed files with 378 additions and 335 deletions.
184 changes: 105 additions & 79 deletions 01_constructors.ipynb

Large diffs are not rendered by default.

171 changes: 67 additions & 104 deletions 02_basicinfo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
"metadata": {},
"source": [
"# Introduction to DataFrames\n",
"**[Bogumił Kamiński](http://bogumilkaminski.pl/about/), May 23, 2018**"
"**[Bogumił Kamiński](http://bogumilkaminski.pl/about/), July 25, 2018**"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"using DataFrames # load package"
Expand Down Expand Up @@ -122,75 +120,28 @@
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"A\n",
"Summary Stats:\n",
"Mean: 1.500000\n",
"Minimum: 1.000000\n",
"1st Quartile: 1.250000\n",
"Median: 1.500000\n",
"3rd Quartile: 1.750000\n",
"Maximum: 2.000000\n",
"Length: 2\n",
"Type: Int64\n",
"\n",
"B\n",
"Summary Stats:\n",
"Mean: 1.000000\n",
"Minimum: 1.000000\n",
"1st Quartile: 1.000000\n",
"Median: 1.000000\n",
"3rd Quartile: 1.000000\n",
"Maximum: 1.000000\n",
"Length: 2\n",
"Type: Union{Float64, Missings.Missing}\n",
"Number Missing: 1\n",
"% Missing: 50.000000\n",
"\n",
"C\n",
"Summary Stats:\n",
"Length: 2\n",
"Type: String\n",
"Number Unique: 2\n",
"\n"
]
"data": {
"text/html": [
"<table class=\"data-frame\"><thead><tr><th></th><th>variable</th><th>mean</th><th>min</th><th>median</th><th>max</th><th>nunique</th><th>nmissing</th><th>eltype</th></tr></thead><tbody><tr><th>1</th><td>A</td><td>1.5</td><td>1</td><td>1.5</td><td>2</td><td></td><td></td><td>Int64</td></tr><tr><th>2</th><td>B</td><td>1.0</td><td>1.0</td><td>1.0</td><td>1.0</td><td></td><td>1</td><td>Float64</td></tr><tr><th>3</th><td>C</td><td></td><td>a</td><td></td><td>b</td><td>2</td><td></td><td>String</td></tr></tbody></table>"
],
"text/plain": [
"3×8 DataFrames.DataFrame\n",
"│ Row │ variable │ mean │ min │ median │ max │ nunique │ nmissing │ eltype │\n",
"├─────┼──────────┼──────┼─────┼────────┼─────┼─────────┼──────────┼─────────┤\n",
"│ 1 │ A │ 1.5 │ 1 │ 1.5 │ 2 │ │ │ Int64 │\n",
"│ 2 │ B │ 1.0 │ 1.0 │ 1.0 │ 1.0 │ │ 1 │ Float64 │\n",
"│ 3 │ C │ │ a │ │ b │ 2 │ │ String │"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"describe(x)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Use `showcols` to get informaton about columns stored in a DataFrame."
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"2×3 DataFrames.DataFrame\n",
"│ Col # │ Name │ Eltype │ Missing │ Values │\n",
"├───────┼──────┼──────────────────────────────────┼─────────┼─────────────────┤\n",
"│ 1 │ A │ Int64 │ 0 │ 1 … 2 │\n",
"│ 2 │ B │ Union{Float64, Missings.Missing} │ 1 │ 1.0 … missing │\n",
"│ 3 │ C │ String │ 0 │ a … b │"
]
}
],
"source": [
"showcols(x)"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -200,7 +151,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -212,7 +163,7 @@
" :C"
]
},
"execution_count": 7,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -221,6 +172,13 @@
"names(x)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Future tip: In Julia 0.7 `propertynames` is also supported."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -230,7 +188,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -242,7 +200,7 @@
" String "
]
},
"execution_count": 8,
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -260,10 +218,8 @@
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": true
},
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"y = DataFrame(rand(1:10, 1000, 10));"
Expand All @@ -278,27 +234,27 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"data-frame\"><thead><tr><th></th><th>x1</th><th>x2</th><th>x3</th><th>x4</th><th>x5</th><th>x6</th><th>x7</th><th>x8</th><th>x9</th><th>x10</th></tr></thead><tbody><tr><th>1</th><td>8</td><td>6</td><td>1</td><td>2</td><td>7</td><td>10</td><td>5</td><td>1</td><td>5</td><td>10</td></tr><tr><th>2</th><td>8</td><td>9</td><td>6</td><td>6</td><td>10</td><td>4</td><td>9</td><td>3</td><td>10</td><td>9</td></tr><tr><th>3</th><td>5</td><td>1</td><td>4</td><td>3</td><td>10</td><td>5</td><td>1</td><td>10</td><td>5</td><td>9</td></tr><tr><th>4</th><td>2</td><td>9</td><td>2</td><td>2</td><td>5</td><td>7</td><td>7</td><td>9</td><td>9</td><td>5</td></tr><tr><th>5</th><td>4</td><td>8</td><td>4</td><td>10</td><td>8</td><td>5</td><td>1</td><td>2</td><td>1</td><td>10</td></tr><tr><th>6</th><td>8</td><td>6</td><td>6</td><td>8</td><td>3</td><td>3</td><td>3</td><td>6</td><td>8</td><td>6</td></tr></tbody></table>"
"<table class=\"data-frame\"><thead><tr><th></th><th>x1</th><th>x2</th><th>x3</th><th>x4</th><th>x5</th><th>x6</th><th>x7</th><th>x8</th><th>x9</th><th>x10</th></tr></thead><tbody><tr><th>1</th><td>4</td><td>1</td><td>2</td><td>8</td><td>10</td><td>7</td><td>5</td><td>1</td><td>8</td><td>3</td></tr><tr><th>2</th><td>5</td><td>6</td><td>6</td><td>3</td><td>2</td><td>4</td><td>9</td><td>10</td><td>10</td><td>4</td></tr><tr><th>3</th><td>3</td><td>5</td><td>4</td><td>8</td><td>4</td><td>4</td><td>4</td><td>6</td><td>6</td><td>9</td></tr><tr><th>4</th><td>8</td><td>8</td><td>2</td><td>6</td><td>7</td><td>3</td><td>6</td><td>4</td><td>10</td><td>6</td></tr><tr><th>5</th><td>1</td><td>2</td><td>6</td><td>10</td><td>4</td><td>7</td><td>7</td><td>7</td><td>5</td><td>4</td></tr><tr><th>6</th><td>5</td><td>7</td><td>9</td><td>10</td><td>5</td><td>1</td><td>6</td><td>2</td><td>3</td><td>4</td></tr></tbody></table>"
],
"text/plain": [
"6×10 DataFrames.DataFrame\n",
"│ Row │ x1 │ x2 │ x3 │ x4 │ x5 │ x6 │ x7 │ x8 │ x9 │ x10 │\n",
"├─────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼─────┤\n",
"│ 1 │ 86 │ 1 │ 2 │ 7 │ 10 │ 5 │ 1 │ 510\n",
"│ 2 │ 89 │ 6 │ 610 │ 4 │ 9 │ 3 │ 10 │ 9\n",
"│ 3 │ 51 │ 4 │ 310 │ 5110 │ 5 │ 9 │\n",
"│ 4 │ 29 │ 2 │ 257799 │ 5\n",
"│ 5 │ 484 │ 10 │ 8512110\n",
"│ 6 │ 8668 │ 333686"
"│ 1 │ 4 │ 1 │ 2 │ 8 │ 10 │ 7 │ 5 │ 1 │ 83 \n",
"│ 2 │ 56 │ 6 │ 32 │ 4 │ 9 │ 10 │ 10 │ 4\n",
"│ 3 │ 35 │ 4 │ 84 │ 446 │ 6 │ 9 │\n",
"│ 4 │ 88 │ 2 │ 6736410 │ 6\n",
"│ 5 │ 126 │ 10 │ 477754 \n",
"│ 6 │ 57910 │ 516234"
]
},
"execution_count": 10,
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -316,24 +272,24 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table class=\"data-frame\"><thead><tr><th></th><th>x1</th><th>x2</th><th>x3</th><th>x4</th><th>x5</th><th>x6</th><th>x7</th><th>x8</th><th>x9</th><th>x10</th></tr></thead><tbody><tr><th>1</th><td>1</td><td>10</td><td>5</td><td>7</td><td>8</td><td>6</td><td>1</td><td>2</td><td>3</td><td>6</td></tr><tr><th>2</th><td>1</td><td>1</td><td>2</td><td>7</td><td>9</td><td>7</td><td>3</td><td>3</td><td>3</td><td>3</td></tr><tr><th>3</th><td>4</td><td>6</td><td>1</td><td>2</td><td>1</td><td>1</td><td>4</td><td>7</td><td>9</td><td>4</td></tr></tbody></table>"
"<table class=\"data-frame\"><thead><tr><th></th><th>x1</th><th>x2</th><th>x3</th><th>x4</th><th>x5</th><th>x6</th><th>x7</th><th>x8</th><th>x9</th><th>x10</th></tr></thead><tbody><tr><th>1</th><td>2</td><td>8</td><td>3</td><td>7</td><td>6</td><td>4</td><td>3</td><td>8</td><td>5</td><td>4</td></tr><tr><th>2</th><td>7</td><td>1</td><td>5</td><td>5</td><td>3</td><td>6</td><td>1</td><td>8</td><td>5</td><td>1</td></tr><tr><th>3</th><td>8</td><td>1</td><td>10</td><td>9</td><td>4</td><td>2</td><td>10</td><td>2</td><td>6</td><td>6</td></tr></tbody></table>"
],
"text/plain": [
"3×10 DataFrames.DataFrame\n",
"│ Row │ x1 │ x2 │ x3 │ x4 │ x5 │ x6 │ x7 │ x8 │ x9 │ x10 │\n",
"├─────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼─────┤\n",
"│ 1 │ 110 │ 5 │ 7 │ 861236\n",
"│ 2 │ 1 │ 1 │ 27973333\n",
"│ 3 │ 461 │ 2114 │ 794"
"│ 1 │ 28 │ 3 │ 7 │ 643854\n",
"│ 2 │ 7 │ 1 │ 55361851\n",
"│ 3 │ 8110 │ 94210 │ 266"
]
},
"execution_count": 11,
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -353,7 +309,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -362,7 +318,7 @@
"([1, 2], [1, 2], [1, 2])"
]
},
"execution_count": 12,
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -371,6 +327,13 @@
"x[1], x[:A], x[:, 1]"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Future tip: In Julia 0.7 also accessing column using `x.A` syntax (`getproperty`/`setproperty!`) is supported."
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand All @@ -380,7 +343,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand All @@ -395,7 +358,7 @@
"│ 1 │ 1 │ 1.0 │ a │"
]
},
"execution_count": 13,
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -413,7 +376,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand All @@ -422,7 +385,7 @@
"1"
]
},
"execution_count": 14,
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -440,7 +403,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 14,
"metadata": {},
"outputs": [
{
Expand All @@ -456,7 +419,7 @@
"│ 2 │ 1 │ 1.0 │ b │"
]
},
"execution_count": 15,
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -475,7 +438,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand All @@ -491,7 +454,7 @@
"│ 2 │ 2 │ 2.0 │ b │"
]
},
"execution_count": 16,
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -510,7 +473,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand All @@ -526,7 +489,7 @@
"│ 2 │ 7 │ 8.0 │ b │"
]
},
"execution_count": 17,
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
Expand All @@ -539,15 +502,15 @@
],
"metadata": {
"kernelspec": {
"display_name": "Julia 0.6.0",
"display_name": "Julia 0.6.2",
"language": "julia",
"name": "julia-0.6"
},
"language_info": {
"file_extension": ".jl",
"mimetype": "application/julia",
"name": "julia",
"version": "0.6.0"
"version": "0.6.3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 1335010

Please sign in to comment.