liveBook · Manning

Parquet

As explained in Financial AI in Practice

Parquet is a column-oriented file format for storing structured data with efficient compression and schema metadata.

Parquet is a file format for persisting structured data. It compresses data, preserves data types, and offers faster reads and writes than CSV or JSON. section 11.2.3

Article data pipeline

News fetchers standardize article records into pandas DataFrames and save the results as Parquet files. section 11.2.3

Listing 11.1 NewsAPI fetcher with Parquet persistence
from newsapi import NewsApiClient
import pandas as pd
from datetime import datetime, timedelta

def fetch_newsapi(keywords, days_back=30, api_key='your-api-key'):
    newsapi = NewsApiClient(api_key=api_key)

    from_date = (datetime.now() - timedelta(days=days_back)).strftime('%Y-%m-%d')
    to_date = datetime.now().strftime('%Y-%m-%d')

    query = ' OR '.join([f'"{kw}"' if ' ' in kw else kw for kw in keywords])

    response = newsapi.get_everything(
        q=query,
        from_param=from_date,
        to=to_date,
        language='en',
        sort_by='publishedAt',
        page_size=100
    )                 #1

    rows = []
    for article in response.get('articles', []):
        rows.append({
            'collection_date': datetime.now().strftime('%Y-%m-%d'),
            'title': article.get('title', ''),
            'description': article.get('description', ''),
            'url': article.get('url', ''),
            'source_name': article.get('source', {}).get('name', 'Unknown'),
            'published_at': article.get('publishedAt'),
            'published_dt': pd.to_datetime(article.get('publishedAt'))
        })

    df = pd.DataFrame(rows)
    df['data_source'] = 'NewsAPI'
    return df.drop_duplicates(subset=['url']).reset_index(drop=True)

# Execute and persist (collecting from August 2025 onward)
keywords = ['uranium', 'nuclear energy', 'Kazatomprom', 'Cameco']
df_newsapi = fetch_newsapi(keywords=keywords, days_back=30, api_key='your-api-key')
df_newsapi.to_parquet('newsapi_recent.parquet')
print(f"Saved {len(df_newsapi)} NewsAPI articles")

See a NewsAPI fetcher that collects articles and persists its output as Parquet. section 11.2.3

How Financial AI in Practice covers it

How deep it goes
Compares practical storage benefits without detailing Parquet’s internal encoding or file structure.
Examples
Saves fetched news articles from NewsAPI and RSS sources as Parquet files.
What it assumes
Assumes Python dependencies, including pyarrow, are already installed.
What you can do after
Apply it via pandas to persist standardized fetcher outputs as Parquet files.
How it connects
Links Parquet to pandas DataFrames, CSV, JSON, and fetcher-based data pipelines.

Also explained in

Compare how 9 books explain Parquet →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Financial AI in Practice. The section links point to the parts of the book it draws on.