series = 'D5036'
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 | 1 (100.00%) |
Number of items digitised | 0 (0.00%) |
Number of pages digitised | 0 |
Date of earliest content | 1906 |
Date of latest content | 1935 |
# 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 | 4070634 | D5036 | WHOLE SERIES | Certificates exempting from dictation test (CEDT) book butts (form 21) | 1906 - 1935 | 1906-01-01 00:00:00 | 1935-01-01 00:00:00 | Open | Sydney | 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 | certificates | 1 |
1 | exempting | 1 |
2 | dictation | 1 |
3 | test | 1 |
4 | cedt | 1 |
5 | book | 1 |
6 | butts | 1 |
7 | form | 1 |
8 | 21 | 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 | certificates exempting | 1 |
1 | form 21 | 1 |
2 | butts form | 1 |
3 | test cedt | 1 |
4 | cedt book | 1 |
5 | dictation test | 1 |
6 | book butts | 1 |
7 | exempting from | 1 |
8 | from dictation | 1 |