{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"series = 'A6282'"
]
},
{
"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 A6282
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Folders of newspaper cuttings relating to the Royal Commission on Espionage
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Total items | 14 |
---|
Access status | |
---|
Open | 13 (92.86%) |
Open with exception | 1 (7.14%) |
Number of items digitised | 2 (14.29%) |
---|
Number of pages digitised | 328 |
---|
Date of earliest content | 1954 |
---|
Date of latest content | 1956 |
---|
"
],
"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": 5,
"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",
" 4185721 | \n",
" A6282 | \n",
" 1 | \n",
" [Folders of newspaper cuttings relating to the Royal Commission on Espionage] 14 April 1954 to 22 April 1954 | \n",
" 1954 - 1954 | \n",
" 1954-01-01 00:00:00 | \n",
" 1954-01-01 00:00:00 | \n",
" Open | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
" 1 | \n",
" 4185722 | \n",
" A6282 | \n",
" 2 | \n",
" [Folders of newspaper cuttings relating to the Royal Commission on Espionage] 23 April 1954 to 30 April 1954 | \n",
" 1954 - 1954 | \n",
" 1954-01-01 00:00:00 | \n",
" 1954-01-01 00:00:00 | \n",
" Open with exception | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
" 2 | \n",
" 4185723 | \n",
" A6282 | \n",
" 3 | \n",
" [Folders of newspaper cuttings relating to the Royal Commission on Espionage] 1 May 1954 to 20 May 1954 | \n",
" 1954 - 1954 | \n",
" 1954-01-01 00:00:00 | \n",
" 1954-01-01 00:00:00 | \n",
" Open | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
" 3 | \n",
" 4185724 | \n",
" A6282 | \n",
" 4 | \n",
" [Folders of newspaper cuttings relating to the Royal Commission on Espionage] 23 May 1954 to 10 July 1954 | \n",
" 1954 - 1954 | \n",
" 1954-01-01 00:00:00 | \n",
" 1954-01-01 00:00:00 | \n",
" Open | \n",
" Canberra | \n",
" True | \n",
" 262 | \n",
"
\n",
" 4 | \n",
" 4185725 | \n",
" A6282 | \n",
" 5 | \n",
" [Folders of newspaper cuttings relating to the Royal Commission on Espionage] 11 July 1954 to 14 August 1954 | \n",
" 1954 - 1954 | \n",
" 1954-01-01 00:00:00 | \n",
" 1954-01-01 00:00:00 | \n",
" Open | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 5,
"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": 6,
"metadata": {},
"outputs": [
{
"data": {
"application/vnd.plotly.v1+json": {
"data": [
{
"name": "Digitised",
"type": "bar",
"x": [
1954,
1955
],
"y": [
1,
1
]
},
{
"name": "Not digitised",
"type": "bar",
"x": [
1954,
1955,
1956
],
"y": [
9,
3,
1
]
}
],
"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": 7,
"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": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" \n",
" \n",
" | \n",
" word | \n",
" count | \n",
"
\n",
" \n",
" 9 | \n",
" 1954 | \n",
" 18 | \n",
"
\n",
" 2 | \n",
" cuttings | \n",
" 14 | \n",
"
\n",
" 0 | \n",
" folders | \n",
" 13 | \n",
"
\n",
" 3 | \n",
" relating | \n",
" 13 | \n",
"
\n",
" 4 | \n",
" royal | \n",
" 13 | \n",
"
\n",
" 5 | \n",
" commission | \n",
" 13 | \n",
"
\n",
" 6 | \n",
" espionage | \n",
" 13 | \n",
"
\n",
" 1 | \n",
" newspaper | \n",
" 13 | \n",
"
\n",
" 32 | \n",
" 1955 | \n",
" 5 | \n",
"
\n",
" 22 | \n",
" september | \n",
" 5 | \n",
"
\n",
" 8 | \n",
" april | \n",
" 4 | \n",
"
\n",
" 14 | \n",
" may | \n",
" 3 | \n",
"
\n",
" 19 | \n",
" august | \n",
" 3 | \n",
"
\n",
" 27 | \n",
" october | \n",
" 2 | \n",
"
\n",
" 20 | \n",
" 15 | \n",
" 2 | \n",
"
\n",
" 35 | \n",
" 12 | \n",
" 2 | \n",
"
\n",
" 11 | \n",
" 23 | \n",
" 2 | \n",
"
\n",
" 24 | \n",
" 16 | \n",
" 2 | \n",
"
\n",
" 23 | \n",
" 5 | \n",
" 2 | \n",
"
\n",
" 7 | \n",
" 14 | \n",
" 2 | \n",
"
\n",
" 33 | \n",
" february | \n",
" 2 | \n",
"
\n",
" 17 | \n",
" july | \n",
" 2 | \n",
"
\n",
" 13 | \n",
" 1 | \n",
" 2 | \n",
"
\n",
" 40 | \n",
" press | \n",
" 1 | \n",
"
\n",
" 41 | \n",
" south | \n",
" 1 | \n",
"
\n",
"
"
],
"text/plain": [
""
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"series_details.display_word_counts(title_text)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
" \n",
" \n",
" \n",
" | \n",
" ngram | \n",
" count | \n",
"
\n",
" \n",
" 0 | \n",
" of newspaper | \n",
" 13 | \n",
"
\n",
" 1 | \n",
" relating to | \n",
" 13 | \n",
"
\n",
" 2 | \n",
" newspaper cuttings | \n",
" 13 | \n",
"
\n",
" 3 | \n",
" cuttings relating | \n",
" 13 | \n",
"
\n",
" 4 | \n",
" commission on | \n",
" 13 | \n",
"
\n",
" 5 | \n",
" folders of | \n",
" 13 | \n",
"
\n",
" 6 | \n",
" to the | \n",
" 13 | \n",
"
\n",
" 7 | \n",
" on espionage | \n",
" 13 | \n",
"
\n",
" 8 | \n",
" royal commission | \n",
" 13 | \n",
"
\n",
" 9 | \n",
" the royal | \n",
" 13 | \n",
"
\n",
" 10 | \n",
" 1954 to | \n",
" 9 | \n",
"
\n",
" 11 | \n",
" 1954 folders | \n",
" 9 | \n",
"
\n",
" 12 | \n",
" april 1954 | \n",
" 4 | \n",
"
\n",
" 13 | \n",
" september 1954 | \n",
" 4 | \n",
"
\n",
" 14 | \n",
" may 1954 | \n",
" 3 | \n",
"
\n",
" 15 | \n",
" 1955 to | \n",
" 3 | \n",
"
\n",
" 16 | \n",
" august 1954 | \n",
" 2 | \n",
"
\n",
" 17 | \n",
" espionage 1 | \n",
" 2 | \n",
"
\n",
" 18 | \n",
" espionage 5 | \n",
" 2 | \n",
"
\n",
" 19 | \n",
" espionage 23 | \n",
" 2 | \n",
"
\n",
" 20 | \n",
" july 1954 | \n",
" 2 | \n",
"
\n",
" 21 | \n",
" february 1955 | \n",
" 2 | \n",
"
\n",
" 22 | \n",
" 1955 folders | \n",
" 2 | \n",
"
\n",
" 23 | \n",
" october 1954 | \n",
" 2 | \n",
"
\n",
" 24 | \n",
" 14 april | \n",
" 1 | \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": null,
"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
}