series = 'D2860'
import os
import pandas as pd
import series_details
import plotly.offline as py
py.init_notebook_mode()
df = pd.read_csv(os.path.join('data', '{}.csv'.format(series.replace('/', '-'))), parse_dates=['start_date', 'end_date'])
series_details.display_summary(series, df)
Total items | 1 |
---|---|
Access status | |
Open with exception | 1 (100.00%) |
Number of items digitised | 0 (0.00%) |
Number of pages digitised | 0 |
Date of earliest content | 1902 |
Date of latest content | 1957 |
# Change the number_of_rows value to see more
number_of_rows = 5
# Display dataframe
df[:number_of_rows].style.set_properties(['title'], **{'text-align': 'left'}).set_table_styles([dict(selector="th", props=[("text-align", "center")]),
dict(selector='.row_heading, .blank', props=[('display', 'none')])])
identifier | series | control_symbol | title | contents_dates | start_date | end_date | access_status | location | digitised_status | digitised_pages | |
---|---|---|---|---|---|---|---|---|---|---|---|
0 | 329730 | D2860 | WHOLE SERIES | Immigration Restriction Act exemption certificate register | 1902 - 1957 | 1902-01-01 00:00:00 | 1957-01-01 00:00:00 | Open with exception | Melbourne | False | 0 |
fig = series_details.plot_dates(df)
py.iplot(fig, filename='series-dates-bar')
# Combine all of the file titles into a single string
title_text = a = df['title'].str.lower().str.cat(sep=' ')
series_details.display_word_counts(title_text)
/Users/tim/mycode/naa-data-wap/lib/python3.6/site-packages/pandas/io/formats/style.py:939: RuntimeWarning: divide by zero encountered in long_scalars
word | count | |
---|---|---|
0 | immigration | 1 |
1 | restriction | 1 |
2 | act | 1 |
3 | exemption | 1 |
4 | certificate | 1 |
5 | register | 1 |
# Change ngram_count for larger ngrams (trigrams etc)
ngram_count = 2
series_details.display_top_ngrams(title_text, ngram_count)
/Users/tim/mycode/naa-data-wap/lib/python3.6/site-packages/pandas/io/formats/style.py:939: RuntimeWarning: divide by zero encountered in long_scalars
ngram | count | |
---|---|---|
0 | act exemption | 1 |
1 | certificate register | 1 |
2 | exemption certificate | 1 |
3 | immigration restriction | 1 |
4 | restriction act | 1 |