{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"series = 'K1145'"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"import os\n",
"import pandas as pd\n",
"import series_details\n",
"import plotly.offline as py\n",
"py.init_notebook_mode()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(os.path.join('data', '{}.csv'.format(series.replace('/', '-'))), parse_dates=['start_date', 'end_date'])"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
"
National Archives of Australia: Series K1145
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Certificates of Exemption from Dictation Test, annual certificate number order
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Total items | 4,816 |
---|
Access status | |
---|
Open | 4,791 (99.48%) |
Not yet examined | 25 (0.52%) |
Number of items digitised | 175 (3.63%) |
---|
Number of pages digitised | 874 |
---|
Date of earliest content | 1900 |
---|
Date of latest content | 1955 |
---|
Download the complete CSV file
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"series_details.display_summary(series, df)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Content preview"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": false
},
"outputs": [
{
"data": {
"text/html": [
" \n",
" \n",
" \n",
" | \n",
" identifier | \n",
" series | \n",
" control_symbol | \n",
" title | \n",
" contents_dates | \n",
" start_date | \n",
" end_date | \n",
" access_status | \n",
" location | \n",
" digitised_status | \n",
" digitised_pages | \n",
"
\n",
" \n",
" 0 | \n",
" 1719426 | \n",
" K1145 | \n",
" 1900/95 | \n",
" Ah Kin [Chinese] | \n",
" 1900 - 1900 | \n",
" 1900-01-01 00:00:00 | \n",
" 1900-01-01 00:00:00 | \n",
" Open | \n",
" Perth | \n",
" False | \n",
" 0 | \n",
"
\n",
" 1 | \n",
" 1719427 | \n",
" K1145 | \n",
" 1900/116 | \n",
" Ah Leck [Chinese] | \n",
" 1900 - 1900 | \n",
" 1900-01-01 00:00:00 | \n",
" 1900-01-01 00:00:00 | \n",
" Open | \n",
" Perth | \n",
" False | \n",
" 0 | \n",
"
\n",
" 2 | \n",
" 1719428 | \n",
" K1145 | \n",
" 1900/144 | \n",
" Ah Shim [Chinese] | \n",
" 1900 - 1900 | \n",
" 1900-01-01 00:00:00 | \n",
" 1900-01-01 00:00:00 | \n",
" Open | \n",
" Perth | \n",
" False | \n",
" 0 | \n",
"
\n",
" 3 | \n",
" 1719429 | \n",
" K1145 | \n",
" 1900/165 | \n",
" Mahomet Rasool [Afghan] | \n",
" 1900 - 1900 | \n",
" 1900-01-01 00:00:00 | \n",
" 1900-01-01 00:00:00 | \n",
" Open | \n",
" Perth | \n",
" False | \n",
" 0 | \n",
"
\n",
" 4 | \n",
" 1719431 | \n",
" K1145 | \n",
" 1900/169 | \n",
" Lee Yacke [Chinese] | \n",
" 1900 - 1900 | \n",
" 1900-01-01 00:00:00 | \n",
" 1900-01-01 00:00:00 | \n",
" Open | \n",
" Perth | \n",
" False | \n",
" 0 | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# Change the number_of_rows value to see more\n",
"number_of_rows = 5\n",
"\n",
"# Display dataframe \n",
"df[:number_of_rows].style.set_properties(['title'], **{'text-align': 'left'}).set_table_styles([dict(selector=\"th\", props=[(\"text-align\", \"center\")]),\n",
" dict(selector='.row_heading, .blank', props=[('display', 'none')])])"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plot content dates"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"name": "Digitised",
"type": "bar",
"x": [
1901,
1902,
1903,
1904,
1905,
1906,
1907,
1908,
1909,
1910,
1911,
1912,
1913,
1914,
1915,
1916,
1917,
1918,
1919,
1920,
1921,
1922,
1923,
1924,
1925,
1926,
1927,
1928,
1929,
1930,
1931,
1932,
1933,
1934,
1935,
1936,
1937,
1938,
1939,
1940,
1947
],
"y": [
2,
10,
4,
4,
4,
5,
6,
8,
4,
15,
3,
7,
6,
4,
6,
2,
3,
4,
7,
3,
2,
2,
6,
3,
7,
5,
6,
9,
1,
3,
7,
3,
2,
2,
6,
1,
11,
2,
1,
3,
1
]
},
{
"name": "Not digitised",
"type": "bar",
"x": [
1900,
1901,
1902,
1903,
1904,
1905,
1906,
1907,
1908,
1909,
1910,
1911,
1912,
1913,
1914,
1915,
1916,
1917,
1918,
1919,
1920,
1921,
1922,
1923,
1924,
1925,
1926,
1927,
1928,
1929,
1930,
1931,
1932,
1933,
1934,
1935,
1936,
1937,
1938,
1939,
1940,
1941,
1942,
1943,
1944,
1945,
1946,
1947,
1948,
1949,
1950,
1951,
1952,
1953,
1954,
1955
],
"y": [
42,
80,
209,
113,
127,
152,
195,
219,
164,
205,
232,
238,
281,
237,
210,
200,
206,
159,
168,
200,
225,
196,
139,
139,
112,
131,
122,
117,
109,
117,
104,
77,
56,
61,
68,
72,
50,
51,
46,
34,
46,
26,
26,
26,
26,
26,
27,
39,
27,
27,
28,
27,
27,
27,
27,
27
]
}
],
"layout": {
"barmode": "stack",
"title": "Content dates",
"xaxis": {
"title": "Year"
},
"yaxis": {
"title": "Number of items"
}
}
},
"text/html": [
""
],
"text/vnd.plotly.v1+html": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"fig = series_details.plot_dates(df)\n",
"py.iplot(fig, filename='series-dates-bar')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## View word frequencies"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"# Combine all of the file titles into a single string\n",
"title_text = a = df['title'].str.lower().str.cat(sep=' ')"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" \n",
" \n",
" | \n",
" word | \n",
" count | \n",
"
\n",
" \n",
" 2 | \n",
" chinese | \n",
" 3,293 | \n",
"
\n",
" 0 | \n",
" ah | \n",
" 1,064 | \n",
"
\n",
" 90 | \n",
" japanese | \n",
" 708 | \n",
"
\n",
" 30 | \n",
" indian | \n",
" 593 | \n",
"
\n",
" 8 | \n",
" lee | \n",
" 321 | \n",
"
\n",
" 57 | \n",
" fong | \n",
" 222 | \n",
"
\n",
" 139 | \n",
" wong | \n",
" 192 | \n",
"
\n",
" 12 | \n",
" sing | \n",
" 158 | \n",
"
\n",
" 7 | \n",
" afghan | \n",
" 144 | \n",
"
\n",
" 122 | \n",
" singh | \n",
" 131 | \n",
"
\n",
" 54 | \n",
" chen | \n",
" 123 | \n",
"
\n",
" 40 | \n",
" chong | \n",
" 98 | \n",
"
\n",
" 172 | \n",
" chung | \n",
" 89 | \n",
"
\n",
" 44 | \n",
" wing | \n",
" 88 | \n",
"
\n",
" 75 | \n",
" yee | \n",
" 78 | \n",
"
\n",
" 167 | \n",
" chew | \n",
" 78 | \n",
"
\n",
" 210 | \n",
" mahomed | \n",
" 73 | \n",
"
\n",
" 67 | \n",
" wah | \n",
" 72 | \n",
"
\n",
" 157 | \n",
" chin | \n",
" 69 | \n",
"
\n",
" 71 | \n",
" kee | \n",
" 68 | \n",
"
\n",
" 66 | \n",
" hong | \n",
" 63 | \n",
"
\n",
" 34 | \n",
" khan | \n",
" 61 | \n",
"
\n",
" 323 | \n",
" sam | \n",
" 58 | \n",
"
\n",
" 79 | \n",
" hing | \n",
" 57 | \n",
"
\n",
" 673 | \n",
" born | \n",
" 49 | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"series_details.display_word_counts(title_text)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" \n",
" \n",
" | \n",
" ngram | \n",
" count | \n",
"
\n",
" \n",
" 0 | \n",
" chinese ah | \n",
" 741 | \n",
"
\n",
" 1 | \n",
" chinese lee | \n",
" 199 | \n",
"
\n",
" 2 | \n",
" singh indian | \n",
" 129 | \n",
"
\n",
" 3 | \n",
" japanese ah | \n",
" 122 | \n",
"
\n",
" 4 | \n",
" sing chinese | \n",
" 110 | \n",
"
\n",
" 5 | \n",
" chinese wong | \n",
" 106 | \n",
"
\n",
" 6 | \n",
" indian ah | \n",
" 91 | \n",
"
\n",
" 7 | \n",
" fong chinese | \n",
" 78 | \n",
"
\n",
" 8 | \n",
" chinese fong | \n",
" 78 | \n",
"
\n",
" 9 | \n",
" chinese chen | \n",
" 77 | \n",
"
\n",
" 10 | \n",
" chong chinese | \n",
" 70 | \n",
"
\n",
" 11 | \n",
" you chinese | \n",
" 66 | \n",
"
\n",
" 12 | \n",
" kee chinese | \n",
" 62 | \n",
"
\n",
" 13 | \n",
" lee chinese | \n",
" 53 | \n",
"
\n",
" 14 | \n",
" wah chinese | \n",
" 50 | \n",
"
\n",
" 15 | \n",
" hong chinese | \n",
" 50 | \n",
"
\n",
" 16 | \n",
" wing chinese | \n",
" 49 | \n",
"
\n",
" 17 | \n",
" chinese chung | \n",
" 47 | \n",
"
\n",
" 18 | \n",
" hing chinese | \n",
" 46 | \n",
"
\n",
" 19 | \n",
" shing chinese | \n",
" 45 | \n",
"
\n",
" 20 | \n",
" ah sing | \n",
" 45 | \n",
"
\n",
" 21 | \n",
" bux indian | \n",
" 43 | \n",
"
\n",
" 22 | \n",
" chinese yee | \n",
" 42 | \n",
"
\n",
" 23 | \n",
" chew chinese | \n",
" 41 | \n",
"
\n",
" 24 | \n",
" sam chinese | \n",
" 40 | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Change ngram_count for larger ngrams (trigrams etc)\n",
"ngram_count = 2\n",
"series_details.display_top_ngrams(title_text, ngram_count)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.5"
}
},
"nbformat": 4,
"nbformat_minor": 2
}