{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"series = 'B2836'"
]
},
{
"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 B2836
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Reference material accumulated by agents
"
],
"text/plain": [
""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"Total items | 14 |
---|
Access status | |
---|
Open | 14 (100.00%) |
Number of items digitised | 3 (21.43%) |
---|
Number of pages digitised | 375 |
---|
Date of earliest content | 1926 |
---|
Date of latest content | 1972 |
---|
"
],
"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",
" 412483 | \n",
" B2836 | \n",
" GROUP 62 | \n",
" Peace Publications (Three) | \n",
" 1950 - 1951 | \n",
" 1950-01-01 00:00:00 | \n",
" 1951-01-01 00:00:00 | \n",
" Open | \n",
" Melbourne | \n",
" False | \n",
" 0 | \n",
"
\n",
" 1 | \n",
" 412493 | \n",
" B2836 | \n",
" GROUP 64 | \n",
" Publications of the Australia - Soviet Friendship League (35 Leaflets etc) | \n",
" 1940 - 1944 | \n",
" 1940-01-01 00:00:00 | \n",
" 1944-01-01 00:00:00 | \n",
" Open | \n",
" Melbourne | \n",
" False | \n",
" 0 | \n",
"
\n",
" 2 | \n",
" 412501 | \n",
" B2836 | \n",
" GROUP 59/4 | \n",
" A.C.P. Publications | \n",
" 1932 - 1952 | \n",
" 1932-01-01 00:00:00 | \n",
" 1952-01-01 00:00:00 | \n",
" Open | \n",
" Melbourne | \n",
" False | \n",
" 0 | \n",
"
\n",
" 3 | \n",
" 412505 | \n",
" B2836 | \n",
" GROUP 60 | \n",
" CPA Publications and Others (110 Leaflets etc) | \n",
" circa1952 - 1953 | \n",
" NaT | \n",
" 1953-01-01 00:00:00 | \n",
" Open | \n",
" Melbourne | \n",
" True | \n",
" 264 | \n",
"
\n",
" 4 | \n",
" 412512 | \n",
" B2836 | \n",
" GROUP 53 PART 1 | \n",
" \"Workers Star\" (Nos 129-163, with Gaps) | \n",
" 1939 - 1939 | \n",
" 1939-01-01 00:00:00 | \n",
" 1939-01-01 00:00:00 | \n",
" Open | \n",
" Melbourne | \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": [
1934,
1935,
1936,
1951
],
"y": [
1,
1,
1,
1
]
},
{
"name": "Not digitised",
"type": "bar",
"x": [
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,
1956,
1957,
1958,
1959,
1960,
1961,
1962,
1963,
1964,
1965,
1966,
1967,
1968,
1969,
1970,
1971,
1972
],
"y": [
1,
1,
1,
1,
1,
1,
2,
3,
3,
3,
4,
3,
3,
5,
5,
5,
5,
6,
6,
5,
5,
5,
5,
5,
6,
6,
5,
4,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
3,
1,
1,
1,
1,
1,
1,
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",
" 1 | \n",
" publications | \n",
" 6 | \n",
"
\n",
" 8 | \n",
" leaflets | \n",
" 6 | \n",
"
\n",
" 9 | \n",
" etc | \n",
" 6 | \n",
"
\n",
" 11 | \n",
" cpa | \n",
" 4 | \n",
"
\n",
" 15 | \n",
" star | \n",
" 4 | \n",
"
\n",
" 3 | \n",
" australia | \n",
" 3 | \n",
"
\n",
" 22 | \n",
" issues | \n",
" 3 | \n",
"
\n",
" 14 | \n",
" workers | \n",
" 3 | \n",
"
\n",
" 27 | \n",
" communist | \n",
" 2 | \n",
"
\n",
" 16 | \n",
" nos | \n",
" 2 | \n",
"
\n",
" 28 | \n",
" party | \n",
" 2 | \n",
"
\n",
" 21 | \n",
" 10 | \n",
" 2 | \n",
"
\n",
" 7 | \n",
" 35 | \n",
" 2 | \n",
"
\n",
" 29 | \n",
" 56 | \n",
" 1 | \n",
"
\n",
" 30 | \n",
" 48 | \n",
" 1 | \n",
"
\n",
" 31 | \n",
" campaign | \n",
" 1 | \n",
"
\n",
" 0 | \n",
" peace | \n",
" 1 | \n",
"
\n",
" 32 | \n",
" 1951 | \n",
" 1 | \n",
"
\n",
" 26 | \n",
" 51 | \n",
" 1 | \n",
"
\n",
" 34 | \n",
" publictions | \n",
" 1 | \n",
"
\n",
" 35 | \n",
" 83 | \n",
" 1 | \n",
"
\n",
" 36 | \n",
" reference | \n",
" 1 | \n",
"
\n",
" 37 | \n",
" material | \n",
" 1 | \n",
"
\n",
" 38 | \n",
" accumulated | \n",
" 1 | \n",
"
\n",
" 33 | \n",
" referendum | \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",
" leaflets etc | \n",
" 6 | \n",
"
\n",
" 1 | \n",
" workers star | \n",
" 3 | \n",
"
\n",
" 2 | \n",
" 35 leaflets | \n",
" 2 | \n",
"
\n",
" 3 | \n",
" other publications | \n",
" 2 | \n",
"
\n",
" 4 | \n",
" australia and | \n",
" 2 | \n",
"
\n",
" 5 | \n",
" etc cpa | \n",
" 2 | \n",
"
\n",
" 6 | \n",
" and other | \n",
" 2 | \n",
"
\n",
" 7 | \n",
" party of | \n",
" 2 | \n",
"
\n",
" 8 | \n",
" star nos | \n",
" 2 | \n",
"
\n",
" 9 | \n",
" cpa communist | \n",
" 2 | \n",
"
\n",
" 10 | \n",
" communist party | \n",
" 2 | \n",
"
\n",
" 11 | \n",
" star 10 | \n",
" 2 | \n",
"
\n",
" 12 | \n",
" 10 issues | \n",
" 2 | \n",
"
\n",
" 13 | \n",
" of australia | \n",
" 2 | \n",
"
\n",
" 14 | \n",
" 48 leaflets | \n",
" 1 | \n",
"
\n",
" 15 | \n",
" publictions 83 | \n",
" 1 | \n",
"
\n",
" 16 | \n",
" of the | \n",
" 1 | \n",
"
\n",
" 17 | \n",
" 129-163 with | \n",
" 1 | \n",
"
\n",
" 18 | \n",
" others 110 | \n",
" 1 | \n",
"
\n",
" 19 | \n",
" by agents | \n",
" 1 | \n",
"
\n",
" 20 | \n",
" material accumulated | \n",
" 1 | \n",
"
\n",
" 21 | \n",
" the workers | \n",
" 1 | \n",
"
\n",
" 22 | \n",
" friendship league | \n",
" 1 | \n",
"
\n",
" 23 | \n",
" campaign 1951 | \n",
" 1 | \n",
"
\n",
" 24 | \n",
" cpa publictions | \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": []
},
{
"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
}