{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"series = 'A12694'"
]
},
{
"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 A12694
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Source material collected for a research project on aspects of the cold war in Australia, single number series
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Total items | 25 |
---|
Access status | |
---|
Open with exception | 20 (80.00%) |
Open | 5 (20.00%) |
Number of items digitised | 8 (32.00%) |
---|
Number of pages digitised | 669 |
---|
Date of earliest content | 1965 |
---|
Date of latest content | 1986 |
---|
"
],
"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",
" 7949343 | \n",
" A12694 | \n",
" 8 | \n",
" Directors and Regional Directors Conferences from 1970 | \n",
" 1970 - 1973 | \n",
" 1970-01-01 00:00:00 | \n",
" 1973-01-01 00:00:00 | \n",
" Open with exception | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
" 1 | \n",
" 7949625 | \n",
" A12694 | \n",
" 9 | \n",
" Throssell, Richard Prichard Volume 4 | \n",
" 1965 - 1969 | \n",
" 1965-01-01 00:00:00 | \n",
" 1969-01-01 00:00:00 | \n",
" Open with exception | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
" 2 | \n",
" 7949626 | \n",
" A12694 | \n",
" 10 | \n",
" Throssell, Richard Prichard Volume 5 | \n",
" 1971 - 1974 | \n",
" 1971-01-01 00:00:00 | \n",
" 1974-01-01 00:00:00 | \n",
" Open with exception | \n",
" Canberra | \n",
" True | \n",
" 70 | \n",
"
\n",
" 3 | \n",
" 7949627 | \n",
" A12694 | \n",
" 11 | \n",
" Policy or directives about the employment of homosexuals Volume 2 | \n",
" 1969 - 1969 | \n",
" 1969-01-01 00:00:00 | \n",
" 1969-01-01 00:00:00 | \n",
" Open with exception | \n",
" Canberra | \n",
" False | \n",
" 0 | \n",
"
\n",
" 4 | \n",
" 7949628 | \n",
" A12694 | \n",
" 12 | \n",
" Policy or directives about the employment of homosexuals Volume 3 | \n",
" 1970 - 1971 | \n",
" 1970-01-01 00:00:00 | \n",
" 1971-01-01 00:00:00 | \n",
" Open with exception | \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": [
1965,
1966,
1967,
1968,
1969,
1970,
1971,
1972,
1973,
1974,
1975,
1976,
1977,
1978,
1979,
1980,
1981,
1982,
1983,
1984,
1985,
1986
],
"y": [
1,
1,
1,
2,
1,
2,
5,
3,
3,
3,
2,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
]
},
{
"name": "Not digitised",
"type": "bar",
"x": [
1965,
1966,
1967,
1968,
1969,
1970,
1971,
1972,
1973,
1974,
1975
],
"y": [
1,
1,
2,
2,
7,
5,
8,
7,
4,
2,
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",
" 7 | \n",
" volume | \n",
" 16 | \n",
"
\n",
" 40 | \n",
" papers | \n",
" 6 | \n",
"
\n",
" 39 | \n",
" miscellaneous | \n",
" 6 | \n",
"
\n",
" 14 | \n",
" 2 | \n",
" 5 | \n",
"
\n",
" 26 | \n",
" 1 | \n",
" 4 | \n",
"
\n",
" 30 | \n",
" soviet | \n",
" 4 | \n",
"
\n",
" 31 | \n",
" embassy | \n",
" 4 | \n",
"
\n",
" 48 | \n",
" australia | \n",
" 4 | \n",
"
\n",
" 32 | \n",
" contact | \n",
" 4 | \n",
"
\n",
" 33 | \n",
" members | \n",
" 4 | \n",
"
\n",
" 34 | \n",
" parliament | \n",
" 4 | \n",
"
\n",
" 28 | \n",
" projects | \n",
" 3 | \n",
"
\n",
" 29 | \n",
" branch | \n",
" 3 | \n",
"
\n",
" 15 | \n",
" 3 | \n",
" 3 | \n",
"
\n",
" 13 | \n",
" homosexuals | \n",
" 3 | \n",
"
\n",
" 27 | \n",
" special | \n",
" 3 | \n",
"
\n",
" 12 | \n",
" employment | \n",
" 3 | \n",
"
\n",
" 11 | \n",
" directives | \n",
" 3 | \n",
"
\n",
" 10 | \n",
" policy | \n",
" 3 | \n",
"
\n",
" 8 | \n",
" 4 | \n",
" 3 | \n",
"
\n",
" 61 | \n",
" communist | \n",
" 3 | \n",
"
\n",
" 62 | \n",
" party | \n",
" 3 | \n",
"
\n",
" 38 | \n",
" intelligence | \n",
" 2 | \n",
"
\n",
" 36 | \n",
" briefings | \n",
" 2 | \n",
"
\n",
" 67 | \n",
" organisation | \n",
" 2 | \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",
" miscellaneous papers | \n",
" 6 | \n",
"
\n",
" 1 | \n",
" volume 2 | \n",
" 5 | \n",
"
\n",
" 2 | \n",
" contact with | \n",
" 4 | \n",
"
\n",
" 3 | \n",
" volume 1 | \n",
" 4 | \n",
"
\n",
" 4 | \n",
" of australia | \n",
" 4 | \n",
"
\n",
" 5 | \n",
" embassy contact | \n",
" 4 | \n",
"
\n",
" 6 | \n",
" parliament volume | \n",
" 4 | \n",
"
\n",
" 7 | \n",
" members of | \n",
" 4 | \n",
"
\n",
" 8 | \n",
" of parliament | \n",
" 4 | \n",
"
\n",
" 9 | \n",
" soviet embassy | \n",
" 4 | \n",
"
\n",
" 10 | \n",
" with members | \n",
" 4 | \n",
"
\n",
" 11 | \n",
" branch volume | \n",
" 3 | \n",
"
\n",
" 12 | \n",
" volume 4 | \n",
" 3 | \n",
"
\n",
" 13 | \n",
" policy or | \n",
" 3 | \n",
"
\n",
" 14 | \n",
" the employment | \n",
" 3 | \n",
"
\n",
" 15 | \n",
" special projects | \n",
" 3 | \n",
"
\n",
" 16 | \n",
" communist party | \n",
" 3 | \n",
"
\n",
" 17 | \n",
" projects branch | \n",
" 3 | \n",
"
\n",
" 18 | \n",
" or directives | \n",
" 3 | \n",
"
\n",
" 19 | \n",
" of homosexuals | \n",
" 3 | \n",
"
\n",
" 20 | \n",
" directives about | \n",
" 3 | \n",
"
\n",
" 21 | \n",
" homosexuals volume | \n",
" 3 | \n",
"
\n",
" 22 | \n",
" employment of | \n",
" 3 | \n",
"
\n",
" 23 | \n",
" party of | \n",
" 3 | \n",
"
\n",
" 24 | \n",
" volume 3 | \n",
" 3 | \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": []
},
{
"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
}