<jupyter_start><jupyter_text>Snapshot DownloadThis notebook shows how to download the files for an existing Snapshot.In this notebook...* [Dependencies and Initialisation](Dependencies-and-Initialisation)* [Snapshot Download](Snapshot-Download)* [Load the downloaded AVRO files to a Pandas DataFrame](Load-the-downloaded-AVRO-files-to-a-Pandas-DataFrame)  Dependencies and InitialisationImport statements and environment initialisation using the package `dotenv`. More details in the [Configuration notebook](0.2_configuration.ipynb).<jupyter_code>from factiva.news import Snapshot
from dotenv import load_dotenv
load_dotenv()
print('Done!')<jupyter_output>Done!<jupyter_text>Snapshot DownloadThis operation requires to know the ID of an existing Snapshot. Please see the [User Statistics notebook](1.1_user_statistics.ipynb) in case you'd like to list available Snapshots.* **`download_path`**: _Optional_. Location to download the content. If not provided, a new folder named as the `snapshot_id` will be created in the same folder as this notebook.<jupyter_code>sid = 'ztj2gkbldt'
dpath = f'./data/{sid}'
%%time
s = Snapshot(snapshot_id=sid)
s.download_extraction_files(download_path=dpath)
print('Done!')<jupyter_output>Done!
CPU times: user 6.67 s, sys: 6.44 s, total: 13.1 s
Wall time: 44.8 s<jupyter_text>Load the downloaded AVRO files to a Pandas DataFrameRestuls are stored in the folder named as the Job ID property (`.last_extraction_job.id`). A custom tool allows to load its contents to a DataFrame.<jupyter_code>s.last_extraction_job.job_id
from factiva.news import SnapshotFiles
sf = SnapshotFiles()
articles = sf.read_folder(dpath)
articles.columns
articles[['an', 'publication_datetime', 'title', 'industry_codes', 'language_code']].head()
dpath<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.09542410714285714, 'fraction_numerical': 0.009486607142857142, 'mean_word_length': 6.898678414096916, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 12, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '245931', 'license': 'MIT', 'n_tokens_mistral': 556, 'n_tokens_neox': 538, 'n_words': 176, 'path': '1.8_snapshot_download.ipynb', 'repo_name': 'dowjones/factiva-notebooks-packages', 'size': '1792'}